﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AdmissionRegistryEntry.aspx.cs"
    Inherits="MTRC.ODMS.Web.SOM.AdmissionRegistry.AdmissionRegistryEntry" %>

<%@ Register Src="../UserControl/UCSignatureNew.ascx" TagName="UCSignatureNew" TagPrefix="ucn" %>
<%@ Register Assembly="APJ.Web.UI.WebControls" Namespace="APJ.Web.UI.WebControls"
    TagPrefix="APJ" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="AjaxControlToolkit" %>
<%@ Register Src="~/UserControl/Menu/PageFoot.ascx" TagName="PageFoot" TagPrefix="WebStructure" %>
<%@ Register Src="~/UserControl/Menu/TabStrip.ascx" TagName="TabStrip" TagPrefix="WebStructure" %>
<%@ Register Src="~/UserControl/Menu/PageHead.ascx" TagName="PageHead" TagPrefix="WebStructure" %>
<%@ Register Src="~/UserControl/Menu/MainMenu.ascx" TagName="MainMenu" TagPrefix="WebStructure" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">

    <meta http-equiv="x-ua-compatible" content="IE=9" />

    <title>Operational Data Management System</title>
    <link href="<%=ResolveUrl("~/CSS/common.css")%>" rel="stylesheet" type="text/css" />
    <!-- add by jack 20150702 for U50.2 -->
    <link href="<%=ResolveUrl("~/JqueryUICombox/jquery-ui.css")%>" rel="stylesheet" type="text/css" />
    <script src="<%=ResolveUrl("~/jQuery/jquery-1.6.2.min.js")%>" type="text/javascript"></script>
    <script src="<%=ResolveUrl("~/JqueryUICombox/jquery-ui.js")%>" type="text/javascript"></script>
    <script src="<%=ResolveUrl("~/JqueryUICombox/combox_noclear.js")%>" type="text/javascript"></script>
    <script type="text/jscript" language="JavaScript" src="../../Javascript/CommonFunction.js"></script>
    <!-- ****************************** -->
    <style type="text/css">
        .title1
        {
            font-weight: bold;
            font-size: 15px;
            color: #022d72;
            font-family: "Tahoma" , "Times New Roman" , "Arial" , "Helvetica" , "sans-serif";
        }
        .title2
        {
            font-weight: bold;
            font-size: 12px;
            color: #022d72;
            font-family: "Tahoma" , "Times New Roman" , "Arial" , "Helvetica" , "sans-serif";
        }
        .title2
        {
            font-size: 10px;
            color: #022d72;
            font-family: "Tahoma" , "Times New Roman" , "Arial" , "Helvetica" , "sans-serif";
        }
    </style>
    <script language="javascript" type="text/javascript">
    var ReadOnly='<%=ViewState["ReadOnly"]%>' 
    var msgDepartureMustSave= '<%=this.GetMessage("SOM_DepartureMustSave")%>'
    var UserValidatePath='<%=this.GetMessage("SOM_DepartureMustSave")%>'
    var TNProtected='<%=this.GetMessage("SOM_TNProtected")%>'
    var LeavePage='<%=this.GetMessage("COM_LeavePage")%>'
    var msgTransferSuccess='<%=this.GetMessage("SOM_TranserSuccess")%>'  
//    add by benson 2015-07-16 begin  
// remove by gordon 20151022 U247
//    var stationId='<%=this.ODMUser.StationID.ToString()%>'
    //    add by benson 2015-07-16 end
    /* add by jack 20150702 for U50.2 */

    $(function () {
        InitCombobox();
    });

    
    function InitCombobox() {
        $(".combobox").combobox();
        $("#toggle").click(function () {
            $(".combobox").toggle();
        });
        $(".custom-combobox").css({"height": "20px" });
        /*Comment by jack 20151022 for u256*/
        $(".custom-combobox input").attr("tabindex","5");

        if (screen.width<1025) {
//             $(".custom-combobox input").css({ "width": "239px", "height": "18px","line-height":"18px"  });
$(".custom-combobox input").css({ "width": "75%", "height": "18px","line-height":"18px"  });
             $(".custom-combobox a").css({ "width": "16px", "height": "20px", "position": "relative","top":"-4px","left":"-1px"});
        }
        else if(screen.width<1281){
//             $(".custom-combobox input").css({ "width": "324px", "height": "18px","line-height":"18px" });
$(".custom-combobox input").css({ "width": "74.5%", "height": "18px","line-height":"18px" });
             $(".custom-combobox a").css({ "width": "16px", "height": "20px", "position": "relative","top":"-4px","left":"-1px"});
        }
        else {
//            $(".custom-combobox input").css({ "width": "367px", "height": "18px","line-height":"18px" });
$(".custom-combobox input").css({ "width": "77%", "height": "18px","line-height":"18px" });
            $(".custom-combobox a").css({ "width": "16px", "height": "20px", "position": "relative","top":"-4px","left":"-1px"});
        }
        //alert($("#txtSelectedOU").val());
//        if ($("#txtSelectedOU").val()!="")
//        {
            $(".custom-combobox input").val($("#txtSelectedOU").val());
//        }
        /** add by jack 20150727 for U134 **/
        if (document.getElementById("hdnStaffType").value==1 || document.getElementById("hdnStaffType").value==3) 
        {
            $(".custom-combobox input").attr("readonly","readonly");
        }
        /**********************************/

    }
    /********************************/

    function SetHdnIsValueFromPopupValue()
    {
        document.getElementById("hdnIsValueFromPopup").value = 'N';  //add by hzx on 20090105
        document.getElementById("hdnIsValueFromPopupQualification").value = 'N';  //add by hzx on 20090107
        //may set hdnExtPartyStaffSnapShotID value to '0' or ''
    }
    
    function ShowDetails(clientID)
    {
        window.showModalDialog("../Popup/ShowDetails.aspx?PageID=AdmissionRegistryEntry&ID="+clientID,window,"dialogHeight:250px;dialogWidth:300px,center:yes,resizable:no,scroll:no,status:no");
        return false;
    }
    //add by benson 2015.07.13 begin
    //update by gordon 20150818 add param CallByPage
    function ShowDetailsEngineeringWork(IsCopyAllButon,CallByPage)
    {   //alert(IsCopyAllButon);
        var tnno= document.getElementById("txtTNNumber").value; //txtTNNumber,txtTransactionNumber
        var TransNo= document.getElementById("txtTransactionNumber").value;
        //update by gordon 20151022 U247 | StationId no longer use
//        var ret= window.showModalDialog("../Popup/popupSearchWork.aspx?callByPage="+CallByPage+"&txt_TNNO="+tnno+"&txt_TransNo="+TransNo+"&txt_StationID="+stationId+"&IsCopyAllButon="+IsCopyAllButon,window,"dialogHeight:450px;dialogWidth:1100px,center:yes,resizable:no,scroll:no,status:no");
var ret= window.showModalDialog("../Popup/popupSearchWork.aspx?callByPage="+CallByPage+"&txt_TNNO="+tnno+"&txt_TransNo="+TransNo+"&IsCopyAllButon="+IsCopyAllButon,window,"dialogHeight:450px;dialogWidth:1100px,center:yes,resizable:no,scroll:no,status:no");
        return false;
    }
    
    //add by benson 2015.07.13 end
    function chkHandoerClick(sender,mes)
    {
        var obj = document.getElementById('txtHandoverCheckDetail');
        
        if(obj.value.length>0)
        {
            if(confirm(mes))
            {
                  obj.value='';
            }
            else
            {
                sender.checked=true;
                return;
            }
        }
        
        if(sender.checked)
        {
            obj.readOnly=false;   
        }
        else
        {
            obj.readOnly=true;
        }
    }
    
    function  OpenStaffContractorForm()
    {
       var strURL = "../Popup/PopupSearchStaff.aspx?PageID=AdmissionRegistryEntry"
       window.showModalDialog(strURL, window, "DialogWidth:740px;DialogHeight:520px;help:no;status:no");
       document.getElementById("hdnIsValueFromPopup").value = 'Y'; //add hzx on 20090105
    }
    
    var PersonSelectdQual_CallBackValue;
    //function  PersonSelectdQual(StaffID,EventPersonTypeID,PersonHoldQualKye)
    function  PersonSelectdQual(staffID)
    {
        //--huangyao:20090312:this method need pass Chinese Char, so only can bind the event in background
       //window.showModalDialog("../Popup/PopupQualification.aspx?StaffID=" + document.getElementById("txtStaffID").value + "&EventPersonTypeID=" + document.getElementById("hdnStaffType").value + "&PersonHoldQualKye=" + document.getElementById("hdnPersonHoldQualKye").value + "&StationEventPersonID=" + document.getElementById("hdnStationEventPersonID").value ,window,'dialogHeight:380px;dialogWidth:720px;scroll:no'); 
       window.showModalDialog("../Popup/PopupQualification.aspx?StaffID=" + staffID + "&EventPersonTypeID=" + document.getElementById("hdnStaffType").value + "&PersonHoldQualKye=" + document.getElementById("hdnPersonHoldQualKye").value + "&StationEventPersonID=" + document.getElementById("hdnStationEventPersonID").value ,window,'dialogHeight:380px;dialogWidth:720px;scroll:no'); 
       return PersonSelectdQual_CallBackValue;
    }
    
    function EventAmendTime(bReadOnly)
    {
        returnValue=window.showModalDialog("../Popup/SetRegEventTime.aspx?PageID=AREntryArrival&TimeType=1&ReadOnly=" + bReadOnly + "&StationEventID=" + <%=this.StationEventID %> ,window,'dialogHeight:500px;dialogWidth:830px;center:yes;resizable:yes;scroll:no;status:no;unadorne:yes;return false;'); 
        //window.returnValue='1'
        if(returnValue == "1")
        {
            IsServerChanged=true;
            __doPostBack(document.getElementById("hdnAmendTimeVal").id, "");   
        }
        //return false;
    }
    
    function EventAmendTimeDepart()
    {
    //update by gordon 20160226 - GE Allow user to amend the description even if the event has been compelted
//        window.showModalDialog("../Popup/SetRegEventTime.aspx?PageID=AREntryDepart&TimeType=2&ReadOnly=true&StationEventID=" + <%=this.StationEventID %> ,window,'dialogHeight:500px;dialogWidth:830px,center:yes,resizable:no,scroll:no,status:no');
window.showModalDialog("../Popup/SetRegEventTime.aspx?PageID=AREntryDepart&TimeType=2&ReadOnly=true&StationEventID=" + <%=this.StationEventID %> ,window,'dialogHeight:500px;dialogWidth:830px;center:yes;resizable:no;scroll:no;status:no');
        return false;
    }
    
    function ShowResponsibilityTransferForm()
    {
         //update by Tim 20160701
        document.getElementById("hidBtton").click();
        document.getElementById("hdnIsValueFromPopupQualification").value = 'Y';  //add by hzx ,on 200901070
        var StaffID=document.getElementById("txtStaffID").value;
        var StaffName=document.getElementById("txtStaffName").value;
        var DeptCompany=document.getElementById("txtDepartmentCompany").value;
        var OrgUnit=document.getElementById("txtOrganizationUnit").value;
        var ContactNo=document.getElementById("txtContactNo").value;  
        //var Qual=document.getElementById("txtQualification").value;
        var Qual=document.getElementById("ddlQualification").value;
        var StaffType=document.getElementById("hdnStaffType").value;        
        var StaffTypeProto=document.getElementById("hdnStaffTypeProto").value;
        var EventPersonType=document.getElementById("hdnStationEventPersonID").value;
        var QualKey=document.getElementById("hdnPersonHoldQualKye").value; 
        var ExtPartyStaffSnapShotID=document.getElementById("hdnExtPartyStaffSnapShotID").value; //add by hzx,20090104
        
        //Begin U46 Edward 2015-08-18 
        var StationEventID=document.getElementById("hdnStationEventID").value;
        //End 

        //Add by jack 20151207 u288 Fixed Transfer Time is missing and User should be able to view the signature
        var EventStatus=document.getElementById("hdnStatus").value;
        var TransferStatus=document.getElementById("hdnTransferStatus").value;
        //var ImgSignatureUrl=document.getElementById("ucSignatureNew1_hdnSignFileName").value;
        //End add by jack 20151207 u288 Fixed Transfer Time is missing and User should be able to view the signature

        //alert(StaffID+StaffName+DeptCompany+OrgUnit+ContactNo+Qual+";"+StaffType); 
        //var urlParameter="StaffID=" + StaffID + "&StaffName=" + StaffName +  "&StaffTypeProto=" + StaffTypeProto+"&DeptCompany=" + DeptCompany+ "&OrgUnit=" + OrgUnit+ "&ContactNo=" + ContactNo+ "&Qual=" + Qual + "&QualKey="+QualKey;
        //var urlParameter="StaffID=" + StaffID + "&StaffName=" + StaffName +  "&StaffTypeProto=" + StaffTypeProto+"&DeptCompany=" + DeptCompany+ "&OrgUnit=" + OrgUnit+ "&ContactNo=" + ContactNo+ "&Qual=" + Qual + "&QualKey=" + QualKey + "&ExtPartyStaffSnapShotID=" + ExtPartyStaffSnapShotID + "&SignTypeProto=" + document.getElementById("hdnSignatureTypeArrive").value + "&SignPathProto=" + document.getElementById("hdnSignatureNameArrive").value+ "&StationEventID=" + StationEventID ; //add by hzx,20090104
        //var urlParameter="StaffID=" + escape(StaffID) + "&StaffName=" + escape(StaffName) +  "&StaffTypeProto=" + escape(StaffTypeProto)+"&DeptCompany=" + escape(DeptCompany)+ "&OrgUnit=" + escape(OrgUnit)+ "&ContactNo=" + escape(ContactNo)+ "&Qual=" + escape(Qual) + "&QualKey=" + escape(QualKey) + "&ExtPartyStaffSnapShotID=" + escape(ExtPartyStaffSnapShotID) + "&SignTypeProto=" + escape(document.getElementById("hdnSignatureTypeArrive").value) + "&SignPathProto=" + escape(document.getElementById("hdnSignatureNameArrive").value)+ "&StationEventID=" + escape(StationEventID) ; //add by hzx,20090104
        var urlParameter="StaffID=" + escape(StaffID) + "&StaffName=" + escape(StaffName) +  "&StaffTypeProto=" + escape(StaffTypeProto)+"&DeptCompany=" + escape(DeptCompany)+ "&OrgUnit=" + escape(OrgUnit)+ "&ContactNo=" + escape(ContactNo)+ "&Qual=" + escape(Qual) + "&QualKey=" + escape(QualKey) + "&ExtPartyStaffSnapShotID=" + escape(ExtPartyStaffSnapShotID) + "&SignTypeProto=" + escape(document.getElementById("hdnSignatureTypeArrive").value) + "&SignPathProto=" + escape(document.getElementById("hdnSignatureNameArrive").value)+ "&StationEventID=" + escape(StationEventID)+ "&EventStatus=" + escape(EventStatus)+ "&TransferStatus=" + escape(TransferStatus);//+ "&ImgSignatureUrl=" + escape(ImgSignatureUrl); //Add by jack 20151207 u288 Fixed Transfer Time is missing and User should be able to view the signature 
        //window.showModalDialog(encodeURI("../Popup/PopupResponsibilityTransfer.aspx?"+urlParameter),window,'dialogHeight:640px;dialogWidth:860px,center:yes,resizable:no,scroll:no,status:no');
        window.showModalDialog(("../Popup/PopupResponsibilityTransfer.aspx?"+urlParameter),window,'dialogHeight:640px;dialogWidth:860px,center:yes,resizable:no,scroll:no,status:no');
       
       //Begin U46 Edward 2015-08-10 
        //Remove "Responsibility transfer success!" message, rename button from "Transfer and save" to "Confirm"
        //        if(document.getElementById("hdnTransferChange").value=="1")
        //        {
        //            alert(msgTransferSuccess);
        //        }
        //End U46 

        //BEGIN Edward U46 2015-08-12 It shows this behaviour before save but both items are transferred after save Keep the transfer function in new SOMS (SCAS has, old no): transfer to another person
         __doPostBack("btnRefreshFireRowAfterTransfer");
        //End Edward U46
        return false;
    }
    
    function CreatNew()
    {   
        if (IsServerChanged || IsPageChanged())
        {
            if(confirm(LeavePage))
            {             
               window.location.href="AdmissionRegistryEntry.aspx?Action=New";
            }
        }
        else
        {
           window.location.href="AdmissionRegistryEntry.aspx?Action=New";
        }
        return false;
   }
   
    function CopyAsNew()
    {   
        if (IsServerChanged || IsPageChanged())
        {
            if(!confirm(LeavePage))
            {
               return false;
            }
        }       
   }
    
    function DepartStation(MenuID,bIsTNProtected,bIsUserValidateNeeded,UserId,Domain)
    {
        if (IsServerChanged || IsPageChanged())
        {
            if (confirm(msgDepartureMustSave))
            {
                if(bIsTNProtected=="true")
                {
                     if(confirm(TNProtected))
                     {
                        if(bIsUserValidateNeeded=='true')
                        {
                              showModalDialog( ENV_SSLApplicationPath + "/LPM/Common/validation.aspx?FunID=" + MenuID + "&UserId=" + UserId + "&Domain=" + Domain + "&IsDefaultUser=true",window,'status:no;resizable:no;dialogHeight:192px;dialogWidth:435px;scroll:no;'); 
                              document.getElementById('hdnFlagNeedValit').value = "3"; //to validated user and save data and departure
                              //update by gordon 20150801 U147
                              //update by gordon 20150827 | Save before Check U190
                              return true;
                                //return CheckUnRestore();
                        }
                        else
                        {
                              document.getElementById('hdnFlagNeedValit').value = "1"; //to:save data and departure
                                                            //update by gordon 20150801 U147
                                                            //update by gordon 20150827 | Save before Check U190
                              return true;
                                //return CheckUnRestore();
                        }
                     }
                     else
                     {
                        return false;   // do nothing
                     }
                }
                else
                {
                        if(bIsUserValidateNeeded=='true')
                        {
                              showModalDialog( ENV_SSLApplicationPath+"/LPM/Common/validation.aspx?FunID=" + MenuID + "&UserId=" + UserId + "&Domain=" + Domain + "&IsDefaultUser=true",window,'status:no;resizable:no;dialogHeight:192px;dialogWidth:435px;scroll:no;'); 
                              document.getElementById('hdnFlagNeedValit').value = "3";//to validated user and save data and departure
                                                            //update by gordon 20150801 U147
                                                            //update by gordon 20150827 | Save before Check U190
                             return true;
                               // return CheckUnRestore();
                        }
                        else
                        {
                              document.getElementById('hdnFlagNeedValit').value = "1"; //to:save data and departure
                                                            //update by gordon 20150801 U147
                                                            //update by gordon 20150827 | Save before Check U190
                              return true;
                                //return CheckUnRestore();
                        }
                }
            }
            else
            {
                return false;        // do nothing
            }
        }
        else
        {
              if(bIsTNProtected=='true')
              {
                if(confirm(TNProtected))
                {
                  document.getElementById('hdnFlagNeedValit').value = "2";   //unsave data and popup depature;
                                                //update by gordon 20150801 U147
                                                //update by gordon 20150827 | Save before Check U190
                             return true;
                               // return CheckUnRestore();
                }
                else
                {
                    return false;   // don nothing
                }
               }
               else
               {
                  document.getElementById('hdnFlagNeedValit').value = "2";    //unsave data and popup depature;
                                                //update by gordon 20150801 U147
                                                //update by gordon 20150827 | Save before Check U190
                              return true;
                               // return CheckUnRestore();
               }              
        }        
    }
    
    function ActivityListingClose(MenuID,bIsTNProtected,bIsUserValidateNeeded,UserId,Domain)
    {
        if (IsServerChanged || IsPageChanged())
        {
            if (confirm(msgDepartureMustSave))
            {
                if(bIsTNProtected=="true")
                {
                     if(confirm(TNProtected))
                     {
                        if(bIsUserValidateNeeded=='true')
                        {
                              showModalDialog(ENV_SSLApplicationPath + "/LPM/Common/validation.aspx?FunID=" + MenuID + "&UserId=" + UserId + "&Domain=" + Domain+ "&IsDefaultUser=true",window,'status:no;resizable:no;dialogHeight:192px;dialogWidth:435px;scroll:no;'); 
                              document.getElementById('hdnFlagNeedValit').value = "3"; //to validated user and save data and departure
                              //return true;
                        }
                        else
                        {
                              document.getElementById('hdnFlagNeedValit').value = "1"; //to:save data and departure
                              //return true;
                        }
                     }
                     else
                     {
                        return false;   // do nothing
                     }
                }
                else
                {
                        if(bIsUserValidateNeeded=='true')
                        {
                              showModalDialog(ENV_SSLApplicationPath + "/LPM/Common/validation.aspx?FunID=" + MenuID + "&UserId=" + UserId + "&Domain=" + Domain + "&IsDefaultUser=true",window,'status:no;resizable:no;dialogHeight:192px;dialogWidth:435px;scroll:no;'); 
                              document.getElementById('hdnFlagNeedValit').value = "3";//to validated user and save data and departure
                              //return true;
                        }
                        else
                        {
                              document.getElementById('hdnFlagNeedValit').value = "1"; //to:save data and departure
                              //return true;
                        }
                }
            }
            else
            {
                return false;        // do nothing
            }
        }
        else
        {
              if(bIsTNProtected=='true')
              {
                if(confirm(TNProtected))
                {
                  document.getElementById('hdnFlagNeedValit').value = "2";   //unsave data and popup depature;
                  //return true; 
                }
                else
                {
                    return false;   // don nothing
                }
               }
               else
               {
                  document.getElementById('hdnFlagNeedValit').value = "2";    //unsave data and popup depature;
                  //return true;
               }
        }
        document.getElementById("btnCloseRecord").click();
    }
    
    function Save(bIsUserValidateNeeded,UserId,Domain)
    {     
       if(bIsUserValidateNeeded=='true')
       {
          showModalDialog(ENV_SSLApplicationPath+"/LPM/Common/validation.aspx?FunID=M140102&IsDefaultUser=true"+"&UserId=" + UserId + "&Domain=" + Domain,window,'status:no;resizable:no;dialogHeight:192px;dialogWidth:435px;scroll:no;'); 
          document.getElementById('hdnFlagNeedValit').value = "4"; //to validated user and save data
          //return true;
          return processing(true);
       }
       else
       {
          document.getElementById('hdnFlagNeedValit').value = "5"; //do noting
          //return true;
          return processing(true);
       }
    }
    
    function Save2(bIsUserValidateNeeded,UserId,Domain)
    {       
       if(bIsUserValidateNeeded=='true')
       {
          showModalDialog( ENV_SSLApplicationPath+"/LPM/Common/validation.aspx?FunID=M140102&IsDefaultUser=true"+ "&UserId=" + UserId + "&Domain=" + Domain ,window,'status:no;resizable:no;dialogHeight:192px;dialogWidth:435px;scroll:no;'); 
          document.getElementById('hdnFlagNeedValit').value = "4"; //to validated user and save data
          //return true;
          return processing(true);
       }
       else
       {
          document.getElementById('hdnFlagNeedValit').value = "5"; //do noting
          //return true;
          return processing(true);
       }
    }
    
    function SaveHtmlFile(Path,content)
    {
       var MTRC_SOM_SaveFile=document.getElementById("MTRC_SOM_SaveFile");
	   MTRC_SOM_SaveFile.SaveFile(Path,content);
    }


    function HTMLDecode(input)
{
    var converter = document.createElement("DivOuput");
    converter.innerHTML = input;
    var output = converter.innerText;
    converter = null;
    return output;
}
    
    //add by gordon 20150811 U147
    var unRestoreParams = "";
    //1467
    function DelayHandleDeparture(StationEventID,FunID,Action)
    {
       var isMustSig=document.getElementById("hdnIsMustSig").value;
       var strParameterUrl="StationEventID=" + StationEventID + "&Action=" + Action + "&FunID=" + FunID+"&isMustSig="+isMustSig;
       var returnValue = window.showModalDialog("../Popup/PopupBookOffHandling.aspx?"+strParameterUrl,window,"dialogHeight:500px;dialogWidth:600px,center:yes,resizable:no,scroll:no,status:no");
       
       //Update by jack 20151119 U286 Cannot reload after clicking Save and Proceed in Departure popup window
       //var res=returnValue.split('|'); 
       //if(res.length==4)    
       var pageID=getQueryString("PageID");
       var isBack=getQueryString("isBack");           
       if(returnValue.length==4)         
       {
            processing(true);
            //Update by jack 20151119 for U286
            //var filePath =res[0]; //document.getElementById('hdnfilePath').value;
            //var fileName =res[1]; //document.getElementById('hdnfileName').value;
            //var content = HTMLDecode(res[2]);//document.getElementById('hdncontent').value); //tfs 1937
            //var dayBeforeParam = res[3];//document.getElementById('hdndayBeforeParam').value;
            var filePath =returnValue[0]; 
            var fileName =returnValue[1]; 
            var content = HTMLDecode(returnValue[2]);
            var dayBeforeParam = returnValue[3];
            //End by jack 20151119 for U286

            ExportHtmlToLocal(filePath, fileName, content, dayBeforeParam);

            //Remove by jack 20151126 U286.2  Cannot reload after clicking Save and Proceed in Departure popup window  
            //var pageID=getQueryString("PageID");
            //var isBack=getQueryString("isBack");
            //if(isBack!=null&&isBack!="null"){
            //window.location.href = "AdmissionRegistryEntry.aspx?StationEventID=" + StationEventID+"&isBack=1&pageID="+pageID;
            //}else{
            //   window.location.href = "AdmissionRegistryEntry.aspx?StationEventID=" + StationEventID;
            //}
            //End remove by jack 20151126 U286.2  Cannot reload after clicking Save and Proceed in Departure popup window  
       }
       //add by gordon 20150811 U147 use for open the UnCompleted FireLink Record
       else if(unRestoreParams != "")
       {
            var arrRes = unRestoreParams.split('|');//0.result 1.control key
            var eventStatus = arrRes[0];
            var eventId = arrRes[1];
            if(eventStatus != "2")
            {
                $("img[KeyEventID="+eventId+"]").click();
            }
            return false; //Add by jack 20151126 for U286.2
       }
       //Comment by jack 20151023 for u259
       //else if(res.length==1){ //Update by jack 20151119 for U286
       else if(returnValue.length==1){
            processing(true);
        //Remove by jack 20151126 U286.2  Cannot reload after clicking Save and Proceed in Departure popup window  
        //var pageID=getQueryString("PageID");
        //var isBack=getQueryString("isBack");
        //if(isBack!=null&&isBack!="null"){
        //window.location.href = "AdmissionRegistryEntry.aspx?StationEventID=" + StationEventID+"&isBack=1&pageID="+pageID;
        //}else{
        //   window.location.href = "AdmissionRegistryEntry.aspx?StationEventID=" + StationEventID;
        //}
        //End remove by jack 20151126 U286.2  Cannot reload after clicking Save and Proceed in Departure popup window  
       }  

       //Add by jack 20151126 U286.2  Cannot reload after clicking Save and Proceed in Departure popup window  
       if(isBack!=null&&isBack!="null"){
            window.location.href = "AdmissionRegistryEntry.aspx?StationEventID=" + StationEventID+"&isBack=1&pageID="+pageID;
       }else{
            window.location.href = "AdmissionRegistryEntry.aspx?StationEventID=" + StationEventID;
       }
       //End by jack 20151126 U286.2  Cannot reload after clicking Save and Proceed in Departure popup window  

       //End by jack 20151119 U286 Cannot reload after clicking Save and Proceed in Departure popup window       
    }

    function OpenDepartPage(StationEventID,FunID,Action)
    {
        setTimeout("DelayHandleDeparture('" + StationEventID + "', '" + FunID + "', '" + Action + "')", 0);
    }
    
    ///this function write by Huangyao, need any modfication, please consult Huangyao
    function OpenPopupARAssetLoan(strURL)
    {
        if(strURL == '')
        {
            strURL = '../Popup/PopupARAssetLoan.aspx?ParentStationEventID=<%=this.StationEventID %>&StationEventID=-1&Action=New&IsPageAllReadOnly=0&IsOpenFromAR=1&MenuID=<%=this.MenuID %>&AssetLoanMainDataTmpID=-1&AssetLoanItemDataTmpID=-1';
        }
        else
        {
            var assetLoanMainDataTmpID = document.getElementById("hdnAssetLoanMainDataTmpID").value;
            var assetLoanItemDataTmpID = document.getElementById("hdnAssetLoanItemDataTmpID").value;
            if(assetLoanMainDataTmpID != undefined && assetLoanMainDataTmpID != "" && assetLoanItemDataTmpID != undefined && assetLoanItemDataTmpID!= "")
            {
                var startIndex = strURL.indexOf("AssetLoanMainDataTmpID");
                var tempStr = strURL.substring(0, startIndex);
                strURL = tempStr + '&AssetLoanMainDataTmpID=' + assetLoanMainDataTmpID + '&AssetLoanItemDataTmpID=' + assetLoanItemDataTmpID;
            }
        }

        //--Issue U13:Add By Gordon 2015/05/19
        var admRegId = document.getElementById("hdnStationEventAdmRegID").value;
        strURL += "&AdmRegId="+ (admRegId == "" ? 0 : admRegId);
        //------------------------------------
        
        var returnValue;
        //returnValue = window.open(strURL); 
        //update by gordon 20160203 - ISU40
//        returnValue = window.showModalDialog(strURL,window,'dialogHeight:600px;dialogWidth:850px,center:yes,resizable:no,scroll:no,status:no'); 
returnValue = window.showModalDialog(strURL,window,'dialogHeight:700px;dialogWidth:1280px,center:yes,resizable:no,scroll:no,status:no'); 
//update end by gordon 20160203
        //update by gordon 20151016 U225
        //Update by jack fixed for js error when  clos 'x' of popup asset loan page in admission entry.
        if(returnValue == null || returnValue.length == 0) 
        {
            return false;
        }
        //End update by jack fixed for js error when  clos 'x' of popup asset loan page in admission entry.
        else if(returnValue.length == 3 && returnValue[2] == "cancel")
        {
            var assetLoanMainDataTmpID = returnValue[0];
            var assetLoanItemDataTmpID = returnValue[1];
            document.getElementById("hdnAssetLoanMainDataTmpID").value = assetLoanMainDataTmpID;
            document.getElementById("hdnAssetLoanItemDataTmpID").value = assetLoanItemDataTmpID;
        }
        //update end 20151016 u225
        else
        {
            var assetLoanMainDataTmpID = returnValue[0];
            var assetLoanItemDataTmpID = returnValue[1];
            var isNeedSignAgainInAR = returnValue[2];  //huangyao added 20081124 fixed issue 0629
            //HZX should add two hidden control to save this two value
            document.getElementById("hdnAssetLoanMainDataTmpID").value = assetLoanMainDataTmpID;
            document.getElementById("hdnAssetLoanItemDataTmpID").value = assetLoanItemDataTmpID;
            document.getElementById("hdnIsNeedSignAgainInAR").value = isNeedSignAgainInAR;  //huangyao added 20081124 fixed issue 0629
            //return true;
            
            //btnCopyAsNew_Click
            //touch off the Event--[hdnAssetLoanItemTmpIDChangeFlag_ServerChange]
            if(isNeedSignAgainInAR == '1')  //huangyao added 20081124 fixed issue 0629
            {
                document.getElementById("hdnAssetLoanItemTmpIDChangeFlag").value = document.getElementById("hdnAssetLoanItemTmpIDChangeFlag").value + 'Changed';
            }
            document.getElementById("btnAssetLoanItemTmpIDChangeFlag").click();
        }
    }
    
    //--------------Fire system------------------
    



    function EditFireSystem(strURL)
    {
           var tempID;
           if(strURL == '')
           {
                  if(document.getElementById("hdnFireSystemKey").value == "")
                  {
                     tempID='-1';
                  }
                  else
                  {
                     tempID=document.getElementById("hdnFireSystemKey").value;
                  }
          
                  var txtStaffID = document.getElementById("txtStaffID").value;
                  var lblIsolationDateTime;
                  
                    if(document.getElementById("lblArrivalTime") != null)
                    {
                        lblIsolationDateTime = document.getElementById("lblArrivalTime").value;
                        
                        if(lblIsolationDateTime == undefined || lblIsolationDateTime == "")
                        {
                            lblIsolationDateTime = document.getElementById("lblArrivalTime").innerHTML;
                        }
                    }
                    
                  var imgRequesSrc = document.getElementById("imgStaffType").src;
                  var txtRequestByName;
                    
                    if(document.getElementById("txtStaffName") != null)
                    {
                        txtRequestByName = document.getElementById("txtStaffName").value;

                        if(txtRequestByName == undefined || txtRequestByName == "")
                        {
                            txtRequestByName = document.getElementById("txtStaffName").innerHTML;
                        }
                    }
                    
                    var txtRequestByDept;
                    if(document.getElementById("txtDepartmentCompany") != null)
                    {
                        txtRequestByDept = document.getElementById("txtDepartmentCompany").value;
                        if(txtRequestByDept == undefined || txtRequestByDept == "")
                        {
                            txtRequestByDept = document.getElementById("txtDepartmentCompany").innerHTML;
                        }
                    }
                    //add by gordon 20150710 orgunit insted of depart
                    if(document.getElementById("ddlDepartmentCompany") !=  null){
                        var ddlDepart = document.getElementById("ddlDepartmentCompany");
                        if(ddlDepart.options.length > 0){
                            var selectedText = ddlDepart.options[ddlDepart.selectedIndex].text;
                            txtRequestByDept = selectedText;
                        }
                    }
                    txtRequestByDept = escape(txtRequestByDept);
                    
                    var txtRequestByOU;
                    if(document.getElementById("txtOrganizationUnit") != null)
                    {
                        txtRequestByOU = document.getElementById("txtOrganizationUnit").value;
                        
                        if(txtRequestByOU == undefined || txtRequestByOU == "")
                        {
                            txtRequestByOU = document.getElementById("txtOrganizationUnit").innerHTML;
                        }
                    }
                    
                    var txtRequestByContactNumber;
                    if(document.getElementById("txtContactNo") != null)
                    {
                        txtRequestByContactNumber = document.getElementById("txtContactNo").value;
                        if(txtRequestByContactNumber == undefined || txtRequestByContactNumber == "")
                        {
                            txtRequestByContactNumber = document.getElementById("txtContactNo").innerHTML;
                        }
                    }
                    
                    var txtIsolationDuration;
                    if(document.getElementById("txtEstimatedCompletionTime") != null)
                    {
                        txtIsolationDuration = document.getElementById("txtEstimatedCompletionTime").value;
                        
                        if(txtIsolationDuration == undefined || txtIsolationDuration == "")
                        {
                            txtIsolationDuration = document.getElementById("txtEstimatedCompletionTime").innerHTML;
                        }
                    }
                   //-----------------------Begin Add by Nathan 2015-08-26 U171.1 -----------------------
                    txtIsolationDuration=0;
                   //-----------------------End Add by Nathan 2015-08-26 U171.1 -----------------------

                    var lblEstimatedIsolationDate = document.getElementById("lblShouldCompletionTime").innerText;
                    
                    var txtHandoverNote;
                    if(document.getElementById("txtHandoverCheckDetail") != null)
                    {
                        txtHandoverNote = document.getElementById("txtHandoverCheckDetail").value;
                        
                        if(txtHandoverNote == undefined || txtHandoverNote == "")
                        {
                            txtHandoverNote = document.getElementById("txtHandoverCheckDetail").innerHTML;
                        }
                    }
                    
                    var chkHandoverCheck;
                    //chkHandoverCheck //checked
                    if(document.getElementById("chkHandoverCheck").checked)
                    {
                        //chkHandoverCheck
                        chkHandoverCheck = true;
                    }
                    
                    var hdnInitDateTime;
                    if(document.getElementById("hdnArrivalTimePrototype") !=null)
                    {
                        hdnInitDateTime = document.getElementById("hdnArrivalTimePrototype").value;
                    }
                    
                    var hdnRequestStaffOrExtPartyID;
                    if(document.getElementById("hdnStaffOrExtPartyID") !=null)
                    {
                        hdnRequestStaffOrExtPartyID = document.getElementById("hdnStaffOrExtPartyID").value;
                    }
                    
                    strURL = '../Popup/PopupARFirePortection.aspx?Action=New&ParentStationEventID=-1&ParentEventNo=&tempID=' + escape(tempID) + '&StationEventID=-1&StatffID='+escape(txtStaffID)+'&lblIsolationDateTime='+escape(lblIsolationDateTime)+'&imgRequesSrc='+escape(imgRequesSrc)+'&txtRequestByName='+escape(txtRequestByName)+'&txtRequestByDept='+escape(txtRequestByDept)+'&txtRequestByOU='+escape(txtRequestByOU)+'&txtRequestByContactNumber='+escape(txtRequestByContactNumber)+'&txtIsolationDuration='+escape(txtIsolationDuration)+'&lblEstimatedIsolationDate='+escape(lblEstimatedIsolationDate)+'&chkHandoverCheck='+escape(chkHandoverCheck)+'&txtHandoverNote='+escape(txtHandoverNote)+'&hdnInitDateTime='+escape(hdnInitDateTime)+'&hdnRequestStaffOrExtPartyID='+escape(hdnRequestStaffOrExtPartyID);
   
                }else
                {
                  // add by dylan 20150928 for u196
                  var txtHandoverNote;
                    if(document.getElementById("txtHandoverCheckDetail") != null)
                    {
                        txtHandoverNote = document.getElementById("txtHandoverCheckDetail").value;
                        
                        if(txtHandoverNote == undefined || txtHandoverNote == "")
                        {
                            txtHandoverNote = document.getElementById("txtHandoverCheckDetail").innerHTML;
                        }
                    }
                    
                    var chkHandoverCheck;
                    //chkHandoverCheck //checked
                    if(document.getElementById("chkHandoverCheck").checked)
                    {
                        //chkHandoverCheck
                        chkHandoverCheck = true;
                    }
                   strURL = strURL+'&chkHandoverCheck='+escape(chkHandoverCheck)+'&txtHandoverNote='+escape(txtHandoverNote);
                }
 	    
                var returnValue;        

                //update by gordon U115 20150829
                // returnValue = window.showModalDialog(encodeURI(strURL),window,'dialogHeight:720px;dialogWidth:880px,center:yes,resizable:no,scroll:no,status:no');
                returnValue = window.showModalDialog(strURL,window,'dialogHeight:720px;dialogWidth:1024px,center:yes,resizable:no,scroll:no,status:no');

                if(returnValue == null || returnValue.length == 0)
                {
                    return false;
                }
                else
                {
                    var tempID = returnValue[0];
                    //alert(returnValue[0]);
                    document.getElementById("hdnFireSystemKey").value = tempID; 
                    document.getElementById("btnRefurbish").click();
                    IsServerChanged=true; //this may no use: huangyao
                }       
        }
        
    //----------------------Fire System End ----------------------   
        
    function KeyDown(obj) 
    {         
       if(window.event.keyCode==17 || window.event.keyCode==16)//17-Ctrl,16-shift
       {
            return false;		
       }       
       if((window.event.keyCode==8) || (window.event.keyCode==9) || (window.event.keyCode==46) || (window.event.keyCode==37) || (window.event.keyCode==38) || (window.event.keyCode==39) || (window.event.keyCode==40))
       {
          return true;
       }      
       if((window.event.keyCode>=48 && window.event.keyCode<=57) || (window.event.keyCode>=96 && window.event.keyCode<=105))        
       {              
          return true;
       }
       else
       {	
          event.keyCode=0;
          return false;
       }	
    }       
    
    function IsInteger(val)
    {
        var re;
        re = /^[0-9]*[1-9][0-9]*$/;
        return re.exec(val);	        
    }
 
    function CheckTelNo(obj)
    {         
      if (obj.value!="")
      {
            if (!IsInteger(obj.value))
            {         
              obj.value=obj.title;       
              return false;
            }      
            else
                  return true;
      }
      else
         return true;      
    }
      
    function ExportHtmlToLocal(filePath, fileName, content, dayBeforeParam)
    {
        var varFileObject;
        //Update by jack 20151202 U286 Add error handling to tell user that it fails to save the local htm file
        //var fso = new ActiveXObject("Scripting.FileSystemObject");
        var fso;
        try {
            fso = new ActiveXObject("Scripting.FileSystemObject");
        } catch (e) {
             alert('<%= this.GetMessage("SOM_NewActiveXObjectErrorMSG") %>' + e.description);
        }
        //End Update by jack 20151202 U286 Add error handling to tell user that it fails to save the local htm file
        var varTextFile;
         
         //Attempt to save in d:
         
         //Get file name from server side
         var varClientFolderName = filePath; //gXMLResponse.documentElement.getElementsByTagName("ClientFolderName").item(0).firstChild.nodeValue;
             
        try 
        { 
               if(!fso.FolderExists(varClientFolderName))
               {
                    fso.CreateFolder(varClientFolderName);
               }

               //----------20090318----------------huangyao write for issue 1112-----------begin
               //debugger;
               var fFolder = fso.GetFolder(varClientFolderName);
               var fArray = new Enumerator(fFolder.files);
               var fOld;
               var seperateDay = new Date(); //now
               var dayBefore = parseInt(dayBeforeParam); //---this value must define in Parameter table or in Web.Config, and pase by Invoke place-------------
               seperateDay.setTime(seperateDay.getTime() - dayBefore*24*60*60*1000);
               var dateLastModified;
               var tempDate;
               var newDate;
               for (; !fArray.atEnd(); fArray.moveNext())
               {
                    //delete file one by one
                    fOld = fArray.item()
                    //var dateCreated = fOld.DateCreated;
                    dateLastModified = fOld.DateLastModified; //use last modified date instead of created date
                    tempDate = Date.parse(dateLastModified);
                    newDate = new Date(tempDate);
                    if(newDate < seperateDay) //also need check the filename contains .HMTL...and so on
                    {
                        //debugger;
                        var ii = fOld.name.indexOf(".html");
                        if(fOld.name.indexOf(".html") > -1)
                        {
                            try
                            {
                                fso.DeleteFile(varClientFolderName + fOld.name);
                            }
                            catch(e)
                            {
                                //var aa = '';
                                alert('<%= this.GetMessage("SOM_ARDeleteFileErrorMSG") %>' + e.description);//Add by jack 20151127 for u286 delete file error exception
                            }
                        }
                    }
               }

              varTextFile = fso.OpenTextFile(varClientFolderName + fileName, 2, true,-1); // 2=overwrite, true=create if not exist, -1 = unicode
              varTextFile.write(content);
         }
         catch(e)
         {
                try
                {
                       if(!fso.FolderExists(varClientFolderName))
                       {
                            fso.CreateFolder(varClientFolderName);
                       }
                    varTextFile = fso.OpenTextFile(varClientFolderName + fileName, 2, true,-1); // 2=overwrite, true=create if not exist, -1 = unicode
                    varTextFile.write(content);
             
           
                }
              catch(e)
              {
                   alert('<%= this.GetMessage("SOM_ARSaveFileErrorMSG") %>' + e.description);
              }           
          
         }
         finally
         {
            //add by gordon 20160120 - ISU03
            if(varTextFile && typeof(varTextFile) != "undefined"){
                varTextFile.close();
            }
         }  
    }
         
    //----------------------- Add by zengshunbo 2009-03-12 TD:1214 -----------------------
    document.onkeydown   =   function() {
      var k = window.event.keyCode;
      if (k == 116)   
      {   
              window.event.keyCode    =   0;   
              window.event.returnValue=   false;   
      }   
   }
    //--------------------- End add by zengshunbo 2009-03-12 TD:1214 ---------------------

    //-------------- prototype set cursor Issue U12 Add By Gordon 2015/05/25
    var staffid = "";
    function SetCursor(url) {
        if(document.getElementById("txtStaffID")){
            if(
            (document.getElementById("txtStaffID").value != "" && document.getElementById("txtStaffID").value != staffid) || 
            (document.getElementById("txtStaffID").value == "" && staffid != "")
            ){
                if (document.getElementById("txtStaffID").value != staffid){
                    document.getElementById('CSSCursor').href = url;
                }

                //btnMoreQualification
                //txtContactNo
                //txtStaffName
                //txtDepartmentCompany
                //ddlWorkCategory
                //ddlSubCategory
                SetStaffInfoEnabled(true,true);
            }
        }
        
    }

    function SetStaffInfoEnabled(disabled,needDisabled){
    
         var btnQual = document.getElementById("btnMoreQualification");
        var txtCont =  document.getElementById("txtContactNo");
        var txtName = document.getElementById("txtStaffName");
        var txtDeC = document.getElementById("txtDepartmentCompany");
        var ddlWC = document.getElementById("ddlWorkCategory");
        var ddlSC = document.getElementById("ddlSubCategory");
        var ddlOU = document.getElementById("ddlDepartmentCompany");
        var ddlQual = document.getElementById("ddlQualification");
        if(btnQual){
            btnQual.disabled = disabled;
        }
        if(txtCont){
            txtCont.disabled = disabled;
        }
        if(txtName){
            if(disabled == false && needDisabled == true)
                txtName.disabled = needDisabled;
            else
                txtName.disabled = disabled;
        }
        if(txtDeC){
            if(disabled == false && needDisabled == true)
                txtDeC.disabled = needDisabled;
            else
                txtDeC.disabled = disabled;
        }
        if(ddlWC){
            ddlWC.disabled = disabled;
        }
        if(ddlSC){
            ddlSC.disabled = disabled;
        }
        if(ddlOU){
            ddlOU.disabled = disabled;
        }
        if(ddlQual){
            ddlQual.disabled = disabled;
        }
        //add by benson 2015.07.28  U102
        disabledPage(disabled);
    }
    //---------------------------------------------------------------------
    //add by benson 2015.07.28  U102  begin
    function disabledPage(disabled){
        var updateP=document.getElementById("UpdatePanel6");
        if (updateP) {
            updateP.disabled = disabled;
        }
       
    }
    function backUrl(){
       var pageID=getQueryString("PageID");
        
        if(pageID=="AdmissionRegistryEnquiry"){
            window.location.href ="../AdmissionRegistry/AdmissionRegistryEnquiry.aspx?isBack=1";
        }
        if(pageID=="OutstandingActivitiesListing"){
            window.location.href ="../AOActivityListing/OutstandingActivitiesListing.aspx?isBack=1";
        }
        if(pageID=="AssetLoanEnquiry"){
            window.location.href ="../AssetLoan/AssetLoanEnquiry.aspx?isBack=1";
        }
        if(pageID=="FireProtectionEnquiry"){
            window.location.href ="../FireProtection/FireProtectionEnquiry.aspx?isBack=1";
        }
        
    }
    //add by benson 2015.07.28  U102  end

    //add by gordon 20150811 U147
    //update by gordon 20150827 Save before check U190
//    function CheckUnRestore(){
      function CheckUnRestore(StationEventID,FunID,Action){
        var tempId = $("#hdnTempID").val();
        $.post("AdmissionRegistryEntry.aspx?MODE=chkUnRestore",{TEMPID:tempId},function(result){
            var arrResult = result.split('-');//0.result 1.control key
            if(arrResult[0] != "2"){
                var flag = confirm('<%=GetMessage("SOM_UnRestoreMsg") %>');
                if(flag){
                    //open
                    $("img[KeyEventID="+arrResult[1]+"]").click();
                }else{
                //update by gordon 20150827 U190
//                    __doPostBack("btnDeparture","");
                    OpenDepartPage(StationEventID,FunID,Action);
                }
            }else{
                //update by gordon 20150827 U190
                    //                    __doPostBack("btnDeparture","");
                    OpenDepartPage(StationEventID,FunID,Action);
            }
        });


        return false;
    }

    function OpenHandWrittenForm(isReadOnly, eventSignType, signatureFullFileName) 
    {
        var result;
	    var urlSignature;
	    urlSignature='../Popup/PopupSignatureContainer.htm?isReadOnly=' + isReadOnly + '&eventSignType=' + eventSignType  + '&FormTitle=<%=this.GetLabel("SOM_SignType_HandWritten")%>' + '&signatureFullFileName=' + signatureFullFileName;
        result = window.showModalDialog(urlSignature, "newwin1", "DialogWidth:233px;DialogHeight:210px;help:no;status:no;scroll:no");
    }

    function OpenHandWrittenFormDeparture(isReadOnly, eventSignType, signatureFullFileName) 
    {
        var result;
	    var urlSignature;
	    urlSignature='../Popup/PopupSignatureDepartureContainer.htm?isReadOnly=' + isReadOnly + '&eventSignType=' + eventSignType  + '&FormTitle=<%=this.GetLabel("SOM_SignType_HandWritten")%>' + '&signatureFullFileName=' + signatureFullFileName;
        result = window.showModalDialog(urlSignature, "newwin1", "DialogWidth:233px;DialogHeight:210px;help:no;status:no;scroll:no");
    }
      // add by jack 20151119 for u284 mouseout do not query data
    function TextChanged(obj) {
        if (obj.fireEvent) {
            obj.fireEvent('onchange');
        }
        else {
            obj.onchange();
        }
    }
    
    </script>
    <link href="" rel="stylesheet" type="text/css" />
    <link href="" rel="stylesheet" type="text/css" />
    <link href="" rel="stylesheet" type="text/css" />
    <link href="" rel="stylesheet" type="text/css" />
    <%-- Issue U12: Add By Gordon 2015/05/25  --%>
    <link id="CSSCursor" rel="stylesheet" type="text/css" />
</head>
<body>
    <form id="form1" runat="server">
    <AjaxControlToolkit:ToolkitScriptManager ID="ToolkitScriptManager" runat="server">
    </AjaxControlToolkit:ToolkitScriptManager>
    <table border="0" cellpadding="0" cellspacing="0" class="Page_Container">
        <tr>
            <td colspan="2" class="Page_Head">
                <WebStructure:PageHead ID="PageHead" runat="server" />
            </td>
        </tr>
        <tr>
            <td class="Page_Left">
                <WebStructure:MainMenu ID="MainMenu" runat="server" AppPath="../../" CurrMenuID="M1401" />
            </td>
            <td class="Page_Right">
                <table class="Page_Contents">
                    <tr>
                        <td class="TabStrip" style="height: 2px">
                            <WebStructure:TabStrip ID="TabStrip" CurrMenuID="M140102" ParentMenuID="M1401" DMenuMode="CurrOnly"
                                runat="server" />
                        </td>
                    </tr>
                    <tr>
                        <td class="Contents" style="height: 16px">
                            <asp:UpdatePanel ID="UpdatePanel6" runat="server">
                                <ContentTemplate>
                                    <input runat="server" id="hdnRefash" type="hidden" value="0" onserverchange="hdnRefash_ServerChange" />
                                    <input runat="server" id="hdnStationEventLastUpdataTime" type="hidden" value="0" />
                                    <div id="mainInfo" style="width: 99.6%;" runat="server">
                                        <fieldset style="clear: both; margin-bottom: 10px;">
                                            <legend class="title1" style="background-color: #BAD0FF; width: 99%;">
                                                <asp:Label ID="lblGeneralInformation" runat="server" Font-Bold="True" Font-Size="Small"
                                                    CssClass="CodeSetupCaptionText"></asp:Label>
                                            </legend>
                                            <asp:UpdatePanel ID="UpdatePanel7" runat="server">
                                                <%-- Update by gordon 20151020 U244 --%>
                                                <Triggers>
                                                    <asp:PostBackTrigger ControlID="btnSaveTop" />
                                                </Triggers>
                                                <ContentTemplate>
                                                    <%--update by benson 2015.07.29  U102 begin--%>
                                                    <%--<div id="SecandRow" style="width:100%;padding-left: 10px;padding-right: 10px; padding-top: 5px; padding-bottom: 1px;">
                                    
                                    <div style="float:right;width:48%;">
                                    
                                        <div style="float:left;width:28%;">
                                        <asp:Label ID="lblChangeArrivalReasonFlag" runat="server" Width="95%"></asp:Label>
                                        </div>
                                        <div style="float:left;width:65.5%;">
                                        
                                        <asp:TextBox ID="txtChangeArrivalReason" runat="server" ReadOnly="True" Width="96%" TextMode="MultiLine" Height="43px"></asp:TextBox>
                                        </div>
                                        <div style="float:left;">
                                        <asp:Button ID="btnMoreArrivalReason" runat="server" OnClientClick="ShowDetails(document.getElementById('txtChangeArrivalReason').id);return false;"  Text="..." TabIndex="2" />
                                        </div>
                                        
                                    </div>                                     
                                </div>--%>
                                                    <%--update by benson 2015.07.29  U102 end--%>
                                                    <%--                                   </ContentTemplate>
                                </asp:UpdatePanel>--%>
                                                    <div id="Div1" style="width: 100%; padding-left: 10px; padding-right: 10px; padding-top: 5px;
                                                        padding-bottom: 1px;">
                                                        <div id="ThirdRow" style="float: left; width: 48%;">
                                                            <div style="float: left; width: 100%; padding-top: 10px; padding-bottom: 1px;">
                                                                <div style="float: left; width: 24%;">
                                                                    <asp:Label ID="lblRegistryNumberFlag" runat="server" Font-Bold="True"></asp:Label>
                                                                </div>
                                                                <div style="float: left; width: 74%;">
                                                                    <asp:Label ID="lblRegistryNumber" runat="server" Font-Bold="True"></asp:Label>
                                                                    <input type="hidden" runat="server" id="hdnStationEventID" />
                                                                    <asp:Label ID="lblNewlyCreatedFlag" runat="server" Font-Bold="True" ForeColor="Red"
                                                                        Visible="False"></asp:Label>
                                                                    <asp:Label ID="lblTransferredFlag" runat="server" ForeColor="Red" Visible="False"
                                                                        Font-Bold="True"></asp:Label>
                                                                    <input type="hidden" runat="server" id="hdnStatus" />
                                                                    <asp:Image ID="imgStatus" runat="server" ImageUrl="~/Images/spacer.gif" />
                                                                    <input type="hidden" runat="server" id="hdnHighLight" />
                                                                    <asp:Image ID="imgHighLight" runat="server" ImageUrl="~/Images/spacer.gif" />
                                                                </div>
                                                            </div>
                                                            <div style="float: left; width: 100%; padding-top: 10px; padding-bottom: 1px;">
                                                                <div style="float: left; width: 82%;">
                                                                    <div style="float: left; width: 29%;">
                                                                        <asp:Label ID="lblArrivalTimeFlag" runat="server" Width="95%"></asp:Label>
                                                                    </div>
                                                                    <%--<asp:TextBox ID="txtArrivalTime" runat="server" ReadOnly="True"></asp:TextBox>--%>
                                                                  
                                                                    <asp:Label ID="lblArrivalTime" runat="server"></asp:Label>
                                                                    <input type="hidden" runat="server" id="hdnArrivalDate" />
                                                                    <input type="hidden" runat="server" id="hdnArrivalTime" />
                                                                    <input type="hidden" runat="server" id="hdnArrivalTimePrototype" />
                                                                </div>
                                                                <div style="float: left; width: 17%;">
                                                                    <input id="btnOpenChangeEventTime" name="btnOpenChangeEventTime" runat="server" type="button"
                                                                        title="Change Asset Loan Event Time" value="..." tabindex="1" />
                                                                    <%--onclick="OpenAmendEventTimeForm();"--%>
                                                                    <input type="hidden" id="hdnAmendTimeVal" name="hdnAmendTimeVal" runat="server" onserverchange="hdnAmendTimeVal_ServerChange" />
                                                                    <input type="hidden" runat="server" id="hdnChangeArrivalReason" />
                                                                </div>
                                                            </div>
                                                            <div style="float: left; width: 100%; padding-top: 10px; padding-bottom: 1px;">
                                                                <div style="float: left; width: 24%">
                                                                    <asp:Label ID="lblStaffIDFlag" runat="server"></asp:Label><em>*</em>&nbsp;<asp:Image
                                                                        ID="imgStaffType" runat="server" ImageUrl="../../Images/SOM/StaffType_AddHoc.gif" />
                                                                </div>
                                                                <div style="float: left; width: 75%">
                                                                    <div style="float: left; width: 1px">
                                                                        <input type="hidden" runat="server" id="hdnStaffTypeTooltip1" />
                                                                        <input type="hidden" runat="server" id="hdnStaffTypeTooltip2" />
                                                                        <input type="hidden" runat="server" id="hdnStaffTypeTooltip3" />
                                                                        <input type="hidden" runat="server" id="hdnStaffTypeTooltip4" />
                                                                        <input type="hidden" runat="server" id="hdnStaffType" onserverchange="hdnStaffType_ServerChange" />
                                                                        <input type="hidden" runat="server" id="hdnStaffTypeProto" />
                                                                    </div>
                                                                    <div style="float: left; width: 50%">
                                                                        <input type="hidden" runat="server" id="hdnStaffOrExtPartyID" />
                                                                        <input type="hidden" runat="server" id="hdnStationEventPersonID" />
                                                                        <input type="hidden" runat="server" id="hdnExtPartyStaffSnapShotID" />
                                                                        <input type="hidden" id="hdnIsValueFromPopup" name="hdnIsValueFromPopup" runat="server"
                                                                            value="N" />
                                                                        <%--//add by hzx on 20090105 change 20090105--%>
                                                                        <%-- Issue U12: Update By Gordon 2015/05/25 --%>
                                                                        <%-- <asp:TextBox ID="txtStaffID" runat="server" Width="94%" MaxLength="20" Text="" onkeyup="SetHdnIsValueFromPopupValue();" OnTextChanged="txtStaffID_TextChanged" AutoPostBack="True" TabIndex="3"></asp:TextBox>--%>
                                                                        <asp:TextBox ID="txtStaffID" runat="server" Width="94%" MaxLength="20" Text="" onkeyup="SetHdnIsValueFromPopupValue();"
                                                                            onblur="SetCursor('../../CSS/ForAdmRegWaitCursor.css');TextChanged(this);" OnTextChanged="txtStaffID_TextChanged"
                                                                            AutoPostBack="True" TabIndex="2"></asp:TextBox>
                                                                        <%-- ---------------------------- --%>
                                                                    </div>
                                                                    <div style="float: left; width: 6%">
                                                                        <%--<input id="imgSearchStaff" runat="server" onclick="OpenStaffContractorForm(); return false;" type="image" src="../..//Images/Common/view.png" onserverclick="imgSearchStaff_ServerClick" />--%>
                                                                        <asp:ImageButton ID="imgSearchStaff" runat="server" ImageUrl="~/Images/Common/view.png"
                                                                            OnClientClick="OpenStaffContractorForm();return true;" />
                                                                        <input type="hidden" runat="server" id="hdnTransferResponsibilityKey" />
                                                                    </div>
                                                                    <div style="float: left; width: 25%">
                                                                        <asp:Button ID="btnTransferResponsibility" runat="server" OnClientClick="javascript:ShowResponsibilityTransferForm();return false;"
                                                                            Width="100%" TabIndex="5" />
                                                                    </div>
                                                                    <input type="hidden" runat="server" id="hdnTransferChange" onserverchange="hdnTransferChange_ServerChange" />
                                                                    <input type="hidden"  id="hdnTransferStatus" runat="server" /><%--Add by jack 20151209 u288 Fixed Transfer Time is missing--%>
                                                                </div>
                                                            </div>
                                                            <div style="float: left; width: 100%; padding-top: 10px; padding-bottom: 1px;">
                                                                <div style="float: left; width: 24%;">
                                                                    <asp:Label ID="lblStaffNameFlag" runat="server"></asp:Label><em>*</em>
                                                                </div>
                                                                <div style="float: left; width: 65%;">
                                                                    <input type="hidden" runat="server" id="hdnStaffName" />
                                                                    <asp:TextBox ID="txtStaffName" runat="server" Width="92.5%" MaxLength="50" TabIndex="3"></asp:TextBox>
                                                                </div>
                                                            </div>
                                                            <div style="float: left; width: 100%; padding-top: 10px; padding-bottom: 1px;">
                                                                <div style="float: left; width: 24%;">
                                                                    <asp:Label ID="lblDepartmentCompanyFlag" runat="server"></asp:Label><em>*</em>
                                                                </div>
                                                                <input type="hidden" runat="server" id="hdnDepartmentCompany" />
                                                                <%-- Update by jack 20150630 for U50.2 --%>
                                                                <%--<asp:TextBox ID="txtDepartmentCompany" Width="67.5%" runat="server" MaxLength="50" TabIndex="8"></asp:TextBox>--%>
                                                                <span id="oldCompany" style="display: none;" runat="server">
                                                                    <asp:TextBox ID="txtDepartmentCompany" Width="60%" runat="server" MaxLength="50"
                                                                        TabIndex="4">
                                                                    </asp:TextBox>
                                                                </span>
                                                                <div id="newCompany" class="ui-widget" style="height: 30px; padding-top: 2px;" runat="server">
                                                                    <asp:DropDownList ID="ddlDepartmentCompany" runat="server" CssClass="combobox" Width="68.5%"
                                                                        OnSelectedIndexChanged="ddlDepartmentCompany_SelectedIndexChanged" AutoPostBack="True">
                                                                    </asp:DropDownList>
                                                                    <asp:HiddenField runat="server" ID="txtSelectedOU" ClientIDMode="Static" />
                                                                </div>
                                                                <%--**********************************--%>
                                                            </div>
                                                            <div style="float: left; width: 100%; padding-top: 10px; padding-bottom: 1px; display: none;">
                                                                <div style="float: left; width: 24%">
                                                                    <asp:Label ID="lblOrgUnitFlag" runat="server"></asp:Label>
                                                                </div>
                                                                <div style="float: left; width: 74%">
                                                                    <input type="hidden" runat="server" id="hdnOrganizationUnit" />
                                                                    <asp:TextBox ID="txtOrganizationUnit" Width="92.5%" runat="server" MaxLength="50"
                                                                        Enabled="False"></asp:TextBox>
                                                                </div>
                                                            </div>
                                                            <div style="float: left; width: 100%; padding-top: 10px; padding-bottom: 1px;">
                                                                <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                                                                    <ContentTemplate>
                                                                        <div style="float: left; width: 24%;">
                                                                            <input type="hidden" runat="server" id="hdnStationEventPersonQualID" />
                                                                            <input type="hidden" runat="server" id="hdnPersonHoldQualKye" />
                                                                            <asp:Label ID="lblQualificationFlag" runat="server"></asp:Label>
                                                                            <asp:Label ID="lblMustInput" runat="server" Text="*" ForeColor="Red" Width="1px"
                                                                                Enabled="False" Visible="False"></asp:Label>
                                                                        </div>
                                                                        <span id="oldQualification" runat="server" style="display: none;">
                                                                            <div style="float: left; width: 58.5%;">
                                                                                <asp:TextBox ID="txtQualification" runat="server" Width="96%" ReadOnly="True" TextMode="MultiLine"></asp:TextBox>
                                                                            </div>
                                                                            <div style="float: left; width: 11%;">
                                                                                <input type="hidden" id="hdnIsValueFromPopupQualification" name="hdnIsValueFromPopupQualification"
                                                                                    runat="server" value="N" />
                                                                                <%--//add by hzx on 20090107--%>
                                                                                <asp:Button ID="btnMoreQualification" runat="server" Text="..." TabIndex="6" />
                                                                                <%--huangyao:20090312:this method need pass Chinese Char, so only can bind the event in background-OnClientClick="PersonSelectdQual()"--%>
                                                                            </div>
                                                                        </span>
                                                                        <div id="newQualification" runat="server" style="float: left; width: 66%;">
                                                                            <asp:DropDownList ID="ddlQualification" runat="server" Width="92.5%" OnSelectedIndexChanged="ddlQualification_SelectedIndexChanged"
                                                                                AutoPostBack="True" TabIndex="7">
                                                                            </asp:DropDownList>
                                                                            
                                                                        </div>
                                                                    </ContentTemplate>
                                                                </asp:UpdatePanel>
                                                            </div>
                                                            <%-- ***************************** --%>
                                                            <div style="float: left; width: 100%; padding-top: 10px; padding-bottom: 1px;">
                                                                <div style="float: left; width: 49%;">
                                                                    <div style="float: left; width: 49%;">
                                                                        <asp:Label ID="lblContactNumberFlag" runat="server"></asp:Label><em>*</em>
                                                                    </div>
                                                                    <div style="float: left; width: 49%;">
                                                                        <input type="hidden" runat="server" id="hdnContactNo" />
                                                                        <asp:TextBox ID="txtContactNo" Width="97.1%" runat="server" MaxLength="50" TabIndex="8"></asp:TextBox>
                                                                        <%--onblur="CheckTelNo(this)" onkeydown="javascript:return KeyDown(this)"--%>
                                                                    </div>
                                                                </div>
                                                                <div style="float: right; width: 50%;">
                                                                    <div style="float: left; width: 38%;">
                                                                        <asp:Label ID="lblPersonNumberFlag" runat="server"></asp:Label>
                                                                    </div>
                                                                    <div style="float: left; width: 41%;">
                                                                        <asp:TextBox ID="txtPersonNumber" runat="server" Width="74%" MaxLength="6" onblur="CheckTelNo(this)"
                                                                            onkeydown="javascript:return KeyDown(this)" TabIndex="9"></asp:TextBox>
                                                                    </div>
                                                                </div>
                                                            </div>
                                                            <asp:UpdatePanel ID="work" runat="server">
                                                                <ContentTemplate>
                                                                    <div style="float: left; width: 100%; padding-top: 10px; padding-bottom: 1px;">
                                                                        <input type="hidden" runat="server" id="hdnStationEventAdmRegID" />
                                                                        <div style="float: left; width: 24%;">
                                                                            <asp:Label ID="lblFlagWorkCategory" runat="server"></asp:Label><em>*</em>
                                                                        </div>
                                                                        <div style="float: left; width: 66%;">
                                                                            <asp:DropDownList ID="ddlWorkCategory" runat="server" Width="92.5%" OnSelectedIndexChanged="ddlWorkCategory_SelectedIndexChanged"
                                                                                AutoPostBack="True" TabIndex="10">
                                                                            </asp:DropDownList>
                                                                        </div>
                                                                    </div>
                                                                    <div style="float: left; width: 100%; padding-top: 10px; padding-bottom: 1px;">
                                                                        <div style="float: left; width: 24%;">
                                                                            <asp:Label ID="lblFlagWorkSubCategory" runat="server"></asp:Label><em>*</em>
                                                                        </div>
                                                                        <div style="float: left; width: 66%;">
                                                                            <asp:DropDownList ID="ddlSubCategory" runat="server" Width="92.5%" AutoPostBack="True"
                                                                                OnSelectedIndexChanged="ddlSubCategory_SelectedIndexChanged" TabIndex="11">
                                                                            </asp:DropDownList>
                                                                            <%--
                                                                            delete by gordon 20150827 U168.10
                                                                            <asp:Image ID="imgSignatureRequired" runat="server" ImageUrl="~/Images/spacer.gif" />--%>
                                                                        </div>
                                                                        <div style="float: left; width: 1%;">
                                                                        </div>
                                                                    </div>
                                                                </ContentTemplate>
                                                            </asp:UpdatePanel>
                                                        </div>
                                                        <div style="float: right; width: 52%; vertical-align: top;">
                                                            <%-- update by gordon 20150812 | Update Width --%>
                                                            <%-- <div style="float: left; width: 100%;">--%>
                                                            <div style="float: left;">
                                                                <%--<div style="float: left; width: 28%;">--%>
                                                                <div style="float: left; width: 82px">
                                                                    <%-- update by gordon 20150812 | Update Width --%>
                                                                    <%--<asp:Label ID="lblRemarkFlag" runat="server" Width="100%"></asp:Label>--%>
                                                                    <asp:Label ID="lblRemarkFlag" runat="server"></asp:Label>
                                                                </div>
                                                                <div style="float: left; width: 71%">
                                                                    <asp:TextBox ID="txtRemark" runat="server" TextMode="MultiLine" Height="45px" Width="95%"
                                                                        TabIndex="12"></asp:TextBox>
                                                                </div>
                                                            </div>
                                                            <%-- update by gordon 20150812 | Update Width --%>
                                                            <%-- <div style="float: left; width: 100%;">--%>
                                                            <div style="float: left;">
                                                                <%-- update by gordon 20150812 | Update Width --%>
                                                                <%--<div style="float: left; width: 28%;">--%>
                                                                <div style="float: left; width: 80px">
                                                                    <asp:Label ID="lblArrivalCaption" runat="server"></asp:Label>
                                                                    <%--Modify by elvis on 20180131 for SER-2018056 （default not load  SignaturePaint.）--%>
                                                                    <%--<em>*</em>--%>
                                                                    <em id="emSignMust" runat="server" visible="false">*</em>
                                                                </div>
                                                                <div style="float: left; width: 71%;">
                                                                    <input type="hidden" runat="server" id="hdnStationEventSignID" />
                                                                    <input type="hidden" runat="server" id="hdnSignatureTypeArrive" />
                                                                    <input type="hidden" runat="server" id="hdnSignatureNameArrive" />
                                                                    <input type="hidden" runat="server" id="hdnSignatureFromPopup" />
                                                                    <input type="hidden" runat="server" id="hdnSignatureFileNameFromPopup" />
                                                                    <input type="hidden" runat="server" id="hdnIsMustSig" value="0" />
                                                                    <ucn:UCSignatureNew ID="ucSignatureNew1" runat="server" />
                                                                    <%--ucSignatureArrival--%>
                                                                </div>
                                                            </div>
                                                            <div style="float: left; width: 100%; padding-top: 10px; padding-bottom: 1px;">
                                                                <div style="float: left; width: 98%">
                                                                    <asp:Label ID="lblDepartureCaption" runat="server" />
                                                                    <asp:Label ID="lblDepartureTimeFlag" runat="server" />
                                                                    <%--<asp:ImageButton ID="imgDeparture2" runat="server" ImageUrl="~/Images/SOM/CompletionOfTasksAndStationDeparture.gif"
                                                                                 TabIndex="16" />--%>
                                                                    <%-- add by gordon 20150812 | Add Space  --%>
                                                                    <span style="width: 10px;">&nbsp;</span>
                                                                    <%--
                                                                    delete by gordon 20150827 U168.10
                                                                    <asp:Image ID="imgDeparture" runat="server" ImageUrl="~/Images/SOM/CompletionOfTasksAndStationDeparture.gif" />--%>
                                                                    <%-- update by gordon 20150812 | Update Width --%>
                                                                    <%--<asp:Label ID="lblDepartureTime" runat="server"  />--%><%--Width="110px"--%>
                                                                    <asp:Label ID="lblDepartureTime" runat="server" Width="106px" />
                                                                    <%--<asp:ImageButton ID="imgDepartureAmend" runat="server" OnClientClick="EventAmendTimeDepart();return false;"
                                                                                    ImageUrl="~/Images/SOM/DepartureTimeAmendReason.gif" />--%>
                                                                    <asp:Button ID="btnDepartureAmend" Text="..." Visible="false" runat="server" OnClientClick="EventAmendTimeDepart();return false;"
                                                                        TabIndex="15" />
                                                                    <%-- add by gordon 20150812 | Add Departure Sign Picture
                                                                        delete by gordon 20150827 U168.10
                                                                    --%>
                                                                    <%--<asp:Image ID="imgSignature" runat="server" ImageUrl="~/Images/SOM/Sign_UnSignature.gif"
                                                                        BorderColor="gray" BorderWidth="1" />--%>
                                                                    <asp:Button ID="btnDeparture" runat="server" OnClick="btnDeparture_Click" TabIndex="16" />
                                                                    <asp:HiddenField ID="hdnTempID" runat="server" Value="-1" />
                                                                    <%-- add by gordon 20150827 U168.10 --%>
                                                                    <asp:Image ID="imgDeparture" runat="server" ImageUrl="~/Images/SOM/CompletionOfTasksAndStationDeparture.gif" />
                                                                    <asp:Image ID="imgSignatureRequired" runat="server" ImageUrl="~/Images/spacer.gif"
                                                                        Width="16px" />
                                                                    <asp:Image ID="imgSignature" runat="server" ImageUrl="~/Images/SOM/Sign_UnSignature.gif"
                                                                        Visible="false" BorderColor="gray" BorderWidth="1" />
                                                                    <%-- add by gordon 20150811 U147 --%>
                                                                    <input type="hidden" runat="server" id="hdnStationEventCompleteSignID" />
                                                                    <input type="hidden" runat="server" id="hdnSignatureTypeDepart" />
                                                                    <input type="hidden" runat="server" id="hdnSignatureNameDepart" />
                                                                    <input type="hidden" runat="server" id="hdnDepartDate" />
                                                                    <input type="hidden" runat="server" id="hdnDepartTime" />
                                                                    <input type="hidden" runat="server" id="hdnChangeDepartReason" />
                                                                    <asp:Button ID="btnSaveTop" runat="server"  OnClick="btnSave_Click" TabIndex="17" />
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </ContentTemplate>
                                            </asp:UpdatePanel>
                                        </fieldset>
                                    </div>
                                    <a name="#JobDescription" target="_self"></a>
                                    <div style="width: 99.6%;">
                                        <fieldset style="clear: both; margin-bottom: 10px;">
                                            <legend class="title1" style="background-color: #BAD0FF; width: 98%;">
                                                <asp:Label ID="lblWorkRequirementCaption" runat="server" Font-Bold="True" Font-Size="Small"
                                                    CssClass="CodeSetupCaptionText"></asp:Label>
                                            </legend>
                                            <div id="Div2" style="width: 100%; padding-left: 10px; padding-top: 5px; padding-bottom: 5px;">
                                                <div style="float: left; width: 28%;">
                                                    <div style="float: left; width: 40%; padding-top: 3px;">
                                                        <asp:Label ID="lblTNNumber" runat="server"></asp:Label><br />
                                                        <asp:Label ID="lblRemidner" runat="server" Font-Size="7"></asp:Label>
                                                    </div>
                                                    <div style="float: left; width: 54%; text-align: left;">
                                                        <asp:TextBox ID="txtTNNumber" runat="server" Width="95%" MaxLength="20" TabIndex="18"></asp:TextBox>
                                                    </div>
                                                    <div style="float: left; width: 6%; padding-top: 3px; text-align: left;">
                                                        <asp:ImageButton ID="imgWork" runat="server" ImageUrl="~/Images/Common/view.png"
                                                            OnClientClick="ShowDetailsEngineeringWork(true,1);return true;" />
                                                        <%--<asp:Button ID="btnTNNumberMore" runat="server" Text="..."  OnClientClick="showModalDialog('../Popup/PopupPossession.aspx',window,'dialogHeight:400px;dialogWidth:700px,center:yes,resizable:no,scroll:no,status:no'); return false;" OnClick="btnTNNumberMore_Click" Visible="False" />--%>
                                                    </div>
                                                </div>
                                                <div style="float: left; width: 40%;">
                                                    <div style="float: left; width: 22%; text-align: right; padding-top: 3px;">
                                                        <asp:Label ID="lblTransactionNumber" runat="server"></asp:Label>
                                                        <%-- add by gordon 20150722 U132.3 --%>
                                                        <em id="emMandatory" runat="server" visible="false">*</em>
                                                    </div>
                                                    <div style="float: left; width: 35%; text-align: left; padding-top: 3px;">
                                                        <asp:TextBox ID="txtTransactionNumber" runat="server" MaxLength="20" TabIndex="19"
                                                            Width="98%"></asp:TextBox>
                                                    </div>
                                                    <div style="float: left; width: 40%; text-align: left; padding-top: 3px;">
                                                        <asp:Button ID="btnCopyAllPossession" OnClick="btnCopyAllPossession_Click" runat="server"
                                                            Width="175px" />
                                                         <%-- modified by liuyu 2016/03/15 for IE11 Compatibility Project PI-2015050--%>     
                                                        <%--<asp:Button ID="btnCopyProtectionOnly" OnClick="btnCopyAllPossession_Click" runat="server"
                                                            Width="175px" />--%>
                                                        <asp:Button ID="btnCopyProtectionOnly" OnClick="btnCopyAllPossession_Click" runat="server"
                                                            Width="175px" style="margin-top:2px;" />   
                                                    </div>
                                                </div>
                                                <div style="float: left; width: 30.5%;">
                                                    <%--  edit by dylan 20150921   <div style="float: left; width: 55%; text-align: right; padding-top: 3px;">--%>
                                                    <div style="float: left; width: 54%; text-align: right; padding-top: 3px;">
                                                        <asp:Label ID="lblPossessionCertNo" runat="server" Text="Possession Cert. No.:" Width="90%"></asp:Label>
                                                    </div>
                                                    <div style="float: left; width: 45%;">
                                                        <asp:TextBox ID="txtPossessionCertNo" runat="server" MaxLength="20" TabIndex="20"
                                                            Width="85%"></asp:TextBox>
                                                    </div>
                                                </div>
                                            </div>
                                            <div id="Div3" style="width: 100%; padding-left: 10px; padding-top: 3px; padding-bottom: 5px;">
                                                <div style="float: left; width: 11%;">
                                                    <asp:Label ID="lblJobNature" runat="server" Width="100%"></asp:Label>
                                                </div>
                                                <div style="float: left; width: 86%;">
                                                    <asp:TextBox ID="txtJobNature" runat="server" TextMode="MultiLine" Width="100%" TabIndex="21"></asp:TextBox>
                                                </div>
                                            </div>
                                            <div id="Div4" style="width: 100%; padding-left: 10px; padding-top: 5px; padding-bottom: 5px;">
                                                <div style="float: left; width: 11%;">
                                                    <asp:Label ID="lblJobLocation" runat="server" Width="100%"></asp:Label>
                                                </div>
                                                <div style="float: left; width: 86%;">
                                                    <asp:TextBox ID="txtJobLocation" runat="server" TextMode="MultiLine" Width="100%"
                                                        TabIndex="22"></asp:TextBox>
                                                </div>
                                            </div>
                                            <div id="Div5" style="width: 100%; padding-left: 10px; padding-top: 5px; padding-bottom: 5px;">
                                                <div style="float: left; width: 11%;">
                                                    <asp:Label ID="lblJobProtection" runat="server" Width="100%"></asp:Label>
                                                </div>
                                                <div style="float: left; width: 86%;">
                                                    <asp:TextBox ID="txtJobProtection" runat="server" TextMode="MultiLine" Width="100%"
                                                        TabIndex="23"></asp:TextBox>
                                                </div>
                                            </div>
                                            <div id="Div6" style="width: 100%; padding-left: 10px; padding-top: 5px; padding-bottom: 5px;">
                                                <div style="float: left; width: 44%;">
                                                    <div style="float: left; width: 25%;">
                                                        <asp:Label ID="lblEstimatedCompletionTime" runat="server" Width="98%"></asp:Label>
                                                    </div>
                                                    <asp:UpdatePanel ID="UpdatePanel3" runat="server">
                                                        <ContentTemplate>
                                                            <%--<asp:TextBox ID="txtEstimatedCompletionTime" runat="server" Width="10%" 
                                        OnTextChanged="txtEstimatedCompletionTime_TextChanged" AutoPostBack="True" MaxLength="6" TabIndex="24"></asp:TextBox>--%>
                                                            <%-- Change Validation Method:Update by Gordon 2015/05/21 --%>
                                                            <%-- edit by dylan 20151028 for u91--%>
                                                            <asp:TextBox ID="txtEstimatedCompletionTime" runat="server" Width="10%" AutoPostBack="True"
                                                                OnTextChanged="txtEstimatedCompletionTime_TextChanged" onkeypress="checkDate2(this,4,1)"
                                                                MaxLength="6" TabIndex="24"   onpaste="return checkPasteText(this.value);"></asp:TextBox>
                                                            <asp:Label ID="lblHour" runat="server" Width="10%"></asp:Label>
                                                            <asp:Label ID="lblShouldCompletionTime" runat="server" Width="33%"></asp:Label>
                                                        </ContentTemplate>
                                                    </asp:UpdatePanel>
                                                </div>
                                                <div style="float: left; width: 55%;">
                                                    <div style="float: left; width: 17%; padding-top: 3px;">
                                                        <asp:Label ID="lblSupplement" runat="server" Width="100%"></asp:Label>
                                                    </div>
                                                    <div style="float: left; width: 80%;">
                                                        <asp:TextBox ID="txtSupplement" runat="server" TextMode="MultiLine" Width="99%" TabIndex="25"></asp:TextBox>
                                                    </div>
                                                </div>
                                            </div>
                                            <asp:UpdatePanel ID="UpdatePanel2" runat="server">
                                                <ContentTemplate>
                                                    <div id="Div7" style="width: 100%; padding-left: 10px; padding-top: 5px; padding-bottom: 5px;">
                                                        <div style="float: left; width: 11%;">
                                                            <asp:Label ID="lblHandoverCheck" runat="server" Width="75%"></asp:Label>
                                                            <asp:CheckBox ID="chkHandoverCheck" runat="server" OnCheckedChanged="chkHandoverCheck_CheckedChanged"
                                                                AutoPostBack="True" TabIndex="26" />
                                                        </div>
                                                        <div style="float: left; width: 86%;">
                                                            <div style="float: left;">
                                                                <asp:TextBox ID="txtHandoverCheckDetail" runat="server" TextMode="MultiLine" Width="100%"
                                                                    TabIndex="27"></asp:TextBox>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </ContentTemplate>
                                            </asp:UpdatePanel>
                                            <div id="Div8" style="width: 100%; padding-left: 10px; padding-top: 5px; padding-bottom: 8px;">
                                                <div style="float: left; width: 32.6%; text-align: center;">
                                                    <fieldset style="clear: both; margin-bottom: 1px; width: 96%">
                                                        <legend class="title2">
                                                            <asp:Label ID="lblEngineControlSystemFirst" runat="server"></asp:Label>
                                                        </legend>
                                                        <table border="0" cellpadding="0" cellspacing="0" style="width: 98%; margin-left: 1px;">
                                                            <tr>
                                                                <td align="center" style="width: 100%;">
                                                                    <%--                                                   <asp:RadioButtonList ID="rblEngineControlSystemFirst" runat="server" RepeatDirection="Horizontal" Width="100%">
                                                    <asp:ListItem></asp:ListItem>
                                                    <asp:ListItem></asp:ListItem>
                                                </asp:RadioButtonList>--%>
                                                                    <table border="0" style="width: 100%;">
                                                                        <tr>
                                                                            <td>
                                                                                <asp:RadioButton ID="rblEngineControlSystemFirst0" runat="server" GroupName="rblEngineControlSystemFirst"
                                                                                    TabIndex="28" />
                                                                            </td>
                                                                            <td>
                                                                                <asp:RadioButton ID="rblEngineControlSystemFirst1" runat="server" GroupName="rblEngineControlSystemFirst"
                                                                                    TabIndex="29" />
                                                                            </td>
                                                                        </tr>
                                                                    </table>
                                                                </td>
                                                            </tr>
                                                        </table>
                                                    </fieldset>
                                                </div>
                                                <div style="float: left; width: 32.6%; text-align: center;">
                                                    <fieldset style="clear: both; margin-bottom: 1px; width: 96%">
                                                        <legend class="title2">
                                                            <asp:Label ID="lblEngineControlSystemSecond" runat="server"></asp:Label>
                                                        </legend>
                                                        <table border="0" cellpadding="0" cellspacing="0" style="width: 98%; margin-left: 1px;">
                                                            <tr>
                                                                <td align="center" style="width: 100%;">
                                                                    <%--                                                        <asp:RadioButtonList ID="rblEngineControlSystemSecond" runat="server" RepeatDirection="Horizontal" Width="100%">
                                                        <asp:ListItem Selected="True"></asp:ListItem>
                                                        <asp:ListItem></asp:ListItem>
                                                    </asp:RadioButtonList>--%>
                                                                    <table border="0" style="width: 100%;">
                                                                        <tr>
                                                                            <td>
                                                                                <asp:RadioButton ID="rblEngineControlSystemSecond0" runat="server" GroupName="rblEngineControlSystemSecond"
                                                                                    TabIndex="30" />
                                                                            </td>
                                                                            <td>
                                                                                <asp:RadioButton ID="rblEngineControlSystemSecond1" runat="server" GroupName="rblEngineControlSystemSecond"
                                                                                    TabIndex="31" />
                                                                            </td>
                                                                        </tr>
                                                                    </table>
                                                                </td>
                                                            </tr>
                                                        </table>
                                                    </fieldset>
                                                </div>
                                                <div style="float: left; width: 33%; text-align: center;">
                                                    <fieldset style="clear: both; margin-bottom: 1px; width: 96%">
                                                        <legend class="title2">
                                                            <asp:Label ID="lblEngineControlSystemThird" runat="server" Text="环控系统控制板3"></asp:Label>
                                                        </legend>
                                                        <table border="0" cellpadding="0" cellspacing="0" style="width: 98%; margin-left: 1px;">
                                                            <tr>
                                                                <td align="center" style="width: 100%;">
                                                                    <%-- <asp:RadioButtonList ID="rblEngineControlSystemThird" runat="server" RepeatDirection="Horizontal" Width="100%">
                                                        <asp:ListItem Selected="True"></asp:ListItem>
                                                        <asp:ListItem></asp:ListItem>
                                                    </asp:RadioButtonList>--%>
                                                                    <table border="0" style="width: 100%;">
                                                                        <tr>
                                                                            <td>
                                                                                <asp:RadioButton ID="rblEngineControlSystemThird0" runat="server" GroupName="rblEngineControlSystemThird"
                                                                                    TabIndex="32" />
                                                                            </td>
                                                                            <td>
                                                                                <asp:RadioButton ID="rblEngineControlSystemThird1" runat="server" GroupName="rblEngineControlSystemThird"
                                                                                    TabIndex="33" />
                                                                            </td>
                                                                        </tr>
                                                                    </table>
                                                                </td>
                                                            </tr>
                                                        </table>
                                                    </fieldset>
                                                </div>
                                            </div>
                                        </fieldset>
                                    </div>
                                    <a name="#AssetLoan" target="_self"></a>
                                    <div style="width: 99.6%;">
                                        <asp:UpdatePanel ID="UpdatePanel5" runat="server">
                                            <ContentTemplate>
                                                <fieldset style="clear: both; margin-bottom: 10px;">
                                                    <legend class="title1" style="background-color: #BAD0FF; width: 98%;">
                                                        <asp:Label ID="lblAssetLoanCaption" runat="server" Font-Bold="True" Font-Size="Small"
                                                            CssClass="CodeSetupCaptionText"></asp:Label>
                                                    </legend>
                                                    <table width="100%">
                                                        <tr>
                                                            <td align="left" style="">
                                                                <table border="0" cellpadding="0" cellspacing="0">
                                                                    <tr>
                                                                        <td style="width: 80px">
                                                                            <asp:Label ID="lblALEventNumberFlag" runat="server"></asp:Label>
                                                                        </td>
                                                                        <td style="width: 150px" align="left">
                                                                            <asp:Label ID="lblALEventNumber" runat="server"></asp:Label>
                                                                        </td>
                                                                        <td style="width: 100px">
                                                                            <asp:Label ID="lblALStatus" runat="server"></asp:Label>&nbsp;<asp:Label ID="lblSBCOrDBCCase"
                                                                                runat="server"></asp:Label>&nbsp;<asp:Label ID="lblALHighLight" runat="server"></asp:Label>&nbsp;
                                                                        </td>
                                                                        <td style="width: 200px" align="left">
                                                                            <asp:Image ID="imgALStatus" runat="server" ImageUrl="~/Images/spacer.gif" />&nbsp;
                                                                            <asp:Image ID="imgALHighLight" runat="server" ImageUrl="~/Images/spacer.gif" />
                                                                        </td>
                                                                        <td style="width: 400px" align="right">
                                                                            <div style="float: left; width: 99%; text-align: right;">
                                                                                <%--<asp:Image ID="imgALEdit" runat="server" ImageUrl="~/Images/SOM/grid_edit.gif" Visible="False" />--%>
                                                                                <input id="btnALEdit" type="button" runat="server" visible="false" />&nbsp;&nbsp;
                                                                                <asp:Button ID="btnAddNewAssetLoan" runat="server" OnClientClick="OpenPopupARAssetLoan('');return false;"
                                                                                    TabIndex="34"></asp:Button>
                                                                                <asp:Button ID="btnSaveALInAR" runat="server" Text="单独保存AL(测试用)" OnClick="btnSaveInAR_Click"
                                                                                    Visible="false"></asp:Button>
                                                                                <input type="hidden" id="hdnAssetLoanMainDataTmpID" name="hdnAssetLoanMainDataTmpID"
                                                                                    runat="server" />
                                                                                <input type="hidden" id="hdnAssetLoanItemDataTmpID" name="hdnAssetLoanItemDataTmpID"
                                                                                    runat="server" />
                                                                                <input type="hidden" id="hdnIsNeedSignAgainInAR" name="hdnIsNeedSignAgainInAR" runat="server" />
                                                                                <input type="hidden" id="hdnAssetLoanItemTmpIDChangeFlag" name="hdnAssetLoanItemTmpIDChangeFlag"
                                                                                    onserverchange="hdnAssetLoanItemTmpIDChangeFlag_ServerChange" runat="server" />
                                                                                <input type="button" runat="server" id="btnAssetLoanItemTmpIDChangeFlag" name="btnAssetLoanItemTmpIDChangeFlag"
                                                                                    style="display: none;" onserverclick="btnAssetLoanItemTmpIDChangeFlag_ServerClick" />
                                                                            </div>
                                                                        </td>
                                                                    </tr>
                                                                </table>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td>
                                                                <APJ:CommonGridView ID="grdAssetLoan" runat="server" DataKeyNames="StationEventID"
                                                                    AllowSorting="True" AscPic="~/Images/Common/arrow_up_green.png" AutoGenerateColumns="False"
                                                                    BorderColor="black" CssClass="GridView" DescPic="~/Images/Common/arrow_down_green.png"
                                                                    EnableTheming="True" OnRowDataBound="grdAssetLoan_RowDataBound" OnNeedDataBind="grdAssetLoan_NeedDataBind"
                                                                    PageLinkCount="7" Width="99.3%">
                                                                    <EmptyDataRowStyle CssClass="GridView_Header" />
                                                                    <PagerTemplate>
                                                                        <asp:Table ID="CommonPagerTemplate" runat="server" Width="100%">
                                                                            <asp:TableRow ID="COMGRIDV_TR" runat="server">
                                                                                <asp:TableCell ID="COMGRIDV_Pager_Cell_TotalRecords" runat="server" CssClass="GridView_Pager_Cell_TotalRecords">
                                                                                    <asp:Label ID="Lbl_T_TotalRecords" runat="server">Total Records:</asp:Label>
                                                                                    <asp:Label ID="Lbl_V_TotalRecords" runat="server"></asp:Label>
                                                                                    &nbsp; &nbsp;
                                                                                    <asp:Label ID="Lbl_V_CurPage" runat="server"></asp:Label>
                                                                                    &nbsp;<asp:Label runat="server">/</asp:Label>
                                                                                    &nbsp;<asp:Label ID="Lbl_V_TotalPages" runat="server"></asp:Label>
                                                                                </asp:TableCell>
                                                                                <asp:TableCell ID="COMGRIDV_Pager_Cell_PageSize" runat="server" CssClass="GridView_Pager_Cell_PageSize">
                                                                                    <asp:Label ID="Lbl_T_PageSize" runat="server">PageSize:</asp:Label>
                                                                                    &nbsp;&nbsp;<asp:DropDownList ID="DDL_PageSize" runat="server" AutoPostBack="True">
                                                                                        <asp:ListItem Value="5">5</asp:ListItem>
                                                                                        <asp:ListItem Value="10">10</asp:ListItem>
                                                                                        <asp:ListItem Value="15">15</asp:ListItem>
                                                                                        <asp:ListItem Value="20">20</asp:ListItem>
                                                                                        <asp:ListItem Value="25">25</asp:ListItem>
                                                                                        <asp:ListItem Value="30">30</asp:ListItem>
                                                                                    </asp:DropDownList>
                                                                                </asp:TableCell>
                                                                                <asp:TableCell ID="COMGRIDV_Pager_Cell_Prev" runat="server" CssClass="GridView_Pager_Cell_Prev">
                                                                                    <asp:LinkButton ID="LBtn_Previous" runat="server" CommandArgument="Prev" CommandName="Page"><</asp:LinkButton>
                                                                                </asp:TableCell>
                                                                                <asp:TableCell ID="COMGRIDV_Pager_Cell_PagerLink" runat="server" CssClass="GridView_Pager_Cell_PagerLink">
                                                                                    <asp:Panel ID="Pnl_PageLink" runat="server" CssClass="GridView_Pager_PageLinkPanel">
                                                                                    </asp:Panel>
                                                                                </asp:TableCell>
                                                                                <asp:TableCell ID="COMGRIDV_Pager_Cell_Next" runat="server" CssClass="GridView_Pager_Cell_Next">
                                                                                    <asp:LinkButton ID="LBtn_Next" runat="server" CommandArgument="Next" CommandName="Page">></asp:LinkButton>
                                                                                </asp:TableCell>
                                                                            </asp:TableRow>
                                                                        </asp:Table>
                                                                    </PagerTemplate>
                                                                    <RowStyle CssClass="GridView_Row" />
                                                                    <HeaderStyle CssClass="GridView_Header" />
                                                                    <AlternatingRowStyle CssClass="GridView_AlternativeRow" />
                                                                    <Columns>
                                                                        <%-- Update by jack 20150611 for U25 --%>
                                                                        <%--<asp:BoundField HeaderText="SOM_AssetType" ReadOnly="True" DataField="CDAT_AssetTypeCode" >
                                                    <itemstyle width="18%" />
                                                </asp:BoundField>
                                                <asp:BoundField HeaderText="SOM_AssetItem" ReadOnly="True" DataField="CDAI_AssetitemCode" >
                                                    <itemstyle width="18%" />
                                                </asp:BoundField>--%>
                                                                        <asp:BoundField HeaderText="SOM_AssetType" ReadOnly="True" DataField="CDAT_AssetTypeDesc">
                                                                            <ItemStyle Width="18%" />
                                                                        </asp:BoundField>
                                                                        <asp:BoundField HeaderText="SOM_AssetItem" ReadOnly="True" DataField="CDAI_AssetitemDesc">
                                                                            <ItemStyle Width="18%" />
                                                                        </asp:BoundField>
                                                                        <%-- ****************************** --%>
                                                                        <asp:BoundField HeaderText="SOM_AvailableQty" ReadOnly="True" DataField="NumOfAvailableItem">
                                                                            <ItemStyle Width="8%" />
                                                                        </asp:BoundField>
                                                                        <asp:BoundField HeaderText="SOM_LoanQuantity" ReadOnly="True" DataField="NumOfLoanItem">
                                                                            <ItemStyle Width="8%" />
                                                                        </asp:BoundField>
                                                                        <asp:BoundField HeaderText="SOM_ReturnQuantity" ReadOnly="True" DataField="NumOfReturnItem">
                                                                            <ItemStyle Width="8%" />
                                                                        </asp:BoundField>
                                                                        <asp:TemplateField HeaderText="SOM_BorrowDateTime" SortExpression="LoanTime">
                                                                            <ItemStyle Wrap="False" Width="20%" />
                                                                            <ItemTemplate>
                                                                                <asp:Label ID="lblLoanTime" runat="server" Text='<%# FormatDateTime(Eval("LoanTime"),true) %>'
                                                                                    __designer:wfdid="w11"></asp:Label>
                                                                            </ItemTemplate>
                                                                        </asp:TemplateField>
                                                                        <asp:TemplateField HeaderText="SOM_ReturnDateTime" SortExpression="ReturnTime">
                                                                            <ItemStyle Wrap="False" Width="20%" />
                                                                            <ItemTemplate>
                                                                                <asp:Label ID="lblReturnTime" runat="server" Text='<%# FormatDateTime(Eval("ReturnTime"),true) %>'></asp:Label>
                                                                                <div style="display: none">
                                                                                    <asp:Label ID="lblEventNo" runat="server" Text='<%# Bind("EventNo") %>'></asp:Label>
                                                                                    <asp:Label ID="lblStatusID" runat="server" Text='<%# Bind("EventStatusID") %>'></asp:Label>
                                                                                    <asp:Label ID="lblStatusIDToolTip" runat="server" Text='<%# Bind("CDES_Description") %>'></asp:Label>
                                                                                    <%--[CDES_Description]--%>
                                                                                    <asp:Label ID="lblHighLight" runat="server" Text='<%# Bind("HighLight") %>'></asp:Label>
                                                                                </div>
                                                                            </ItemTemplate>
                                                                        </asp:TemplateField>
                                                                    </Columns>
                                                                    <EmptyDataTemplate>
                                                                        <asp:Table runat="server" CssClass="GridView_Header_EmptyData">
                                                                            <asp:TableRow runat="server">
                                                                                <asp:TableCell runat="server" Style="border-right: black 1px solid;" Width="18%"></asp:TableCell>
                                                                                <asp:TableCell runat="server" Style="border-right: black 1px solid;" Width="18%"></asp:TableCell>
                                                                                <asp:TableCell runat="server" Style="border-right: black 1px solid;" Width="8%"></asp:TableCell>
                                                                                <asp:TableCell runat="server" Style="border-right: black 1px solid;" Width="8%"></asp:TableCell>
                                                                                <asp:TableCell runat="server" Style="border-right: black 1px solid;" Width="8%"></asp:TableCell>
                                                                                <asp:TableCell runat="server" Style="border-right: black 1px solid;" Width="20%"></asp:TableCell>
                                                                                <asp:TableCell runat="server" Width="20%"></asp:TableCell>
                                                                            </asp:TableRow>
                                                                        </asp:Table>
                                                                    </EmptyDataTemplate>
                                                                </APJ:CommonGridView>
                                                            </td>
                                                        </tr>
                                                    </table>
                                                </fieldset>
                                            </ContentTemplate>
                                        </asp:UpdatePanel>
                                    </div>
                                    <a name="#FireLink" target="_self"></a>
                                    <div style="width: 99.6%;">
                                        <asp:UpdatePanel ID="UpdatePanel4" runat="server">
                                            <ContentTemplate>
                                                <fieldset style="clear: both; margin-bottom: 10px;">
                                                    <legend class="title1" style="background-color: #BAD0FF; width: 98%;">
                                                        <asp:Label ID="lblFireLinkCaption" runat="server" Font-Bold="True" Font-Size="Small"
                                                            CssClass="CodeSetupCaptionText"></asp:Label>
                                                    </legend>
                                                    <div>
                                                        <div style="float: left; width: 99%; text-align: right;">
                                                            <div style="display: none;">
                                                                <asp:Button ID="btnRefurbish" runat="server" OnClick="btnRefurbish_Click" /></div>
                                                            <asp:CheckBox ID="chkObsolete" runat="server" AutoPostBack="True" OnCheckedChanged="chkObsolete_CheckedChanged"
                                                                TabIndex="35" />
                                                            <input type="hidden" runat="server" id="hdnFireSystemKey" />
                                                            <asp:Button ID="btnFireAdd" runat="server" OnClientClick="EditFireSystem('');return false;"
                                                                TabIndex="36" />
                                                            <!--issue u46  Begin Edward Update 2015-08-12  -->
                                                            <asp:Button ID="btnRefreshFireRowAfterTransfer" runat="server" Visible="false" OnClick="btnRefreshFireRowAfterTransfer_Click"
                                                                TabIndex="36" />
                                                            <!--End Edward  -->
                                                        </div>
                                                        <table width="100%">
                                                            <tr>
                                                                <td align="left" valign="top" style="float: left;">
                                                                    <APJ:CommonGridView ID="grdFireSystem" runat="server" DataKeyNames="StationEventID,FlagObsolete"
                                                                        AllowPaging="True" AllowSorting="True" AscPic="~/Images/Common/arrow_up_green.png"
                                                                        AutoGenerateColumns="False" BorderColor="black" CssClass="GridView" DescPic="~/Images/Common/arrow_down_green.png"
                                                                        EnableTheming="True" OnRowDataBound="grdFireSystem_RowDataBound" OnNeedDataBind="grdFireSystem_NeedDataBind"
                                                                        PageLinkCount="7" OnRowCommand="grdFireSystem_RowCommand" Width="99.2%">
                                                                        <EmptyDataRowStyle CssClass="GridView_Header" />
                                                                        <Columns>
                                                                            <asp:TemplateField HeaderText="SOM_EventNo" SortExpression="EventNo">
                                                                                <ItemStyle Width="115px" />
                                                                                <ItemTemplate>
                                                                                    <asp:Label ID="lblGrvEventNo" runat="server" Text='<%# Bind("EventNo") %>' __designer:wfdid="w1"></asp:Label>
                                                                                </ItemTemplate>
                                                                            </asp:TemplateField>
                                                                            <asp:TemplateField HeaderText="COM_IsolationTime" SortExpression="EventTime">
                                                                                <ItemStyle Width="115px" />
                                                                                <ItemTemplate>
                                                                                    <asp:Label ID="lblgrvEventTime" runat="server" Text='<%# FormatDateTime(Eval("EventTime"),true)%>'></asp:Label>
                                                                                    <br />
                                                                                    <asp:Label ID="lblgrvEventCompleteTime" runat="server" Text='<%# FormatDateTime(Eval("EventCompleteTime"),true)%>'></asp:Label>
                                                                                </ItemTemplate>
                                                                            </asp:TemplateField>
                                                                            <asp:BoundField DataField="FireLinkCode" HeaderText="SOM_FireLink" SortExpression="FireLinkCode">
                                                                                <ItemStyle Width="85px" />
                                                                            </asp:BoundField>
                                                                            <asp:BoundField DataField="IsolateReason" HeaderText="SOM_Reason" SortExpression="IsolateReason">
                                                                                <ItemStyle Width="90px" />
                                                                            </asp:BoundField>
                                                                            <asp:BoundField DataField="FireLinkStatus" HeaderText="COM_Status" SortExpression="FireLinkStatus">
                                                                                <ItemStyle Width="40px" />
                                                                            </asp:BoundField>
                                                                            <asp:BoundField DataField="BeingIsolatedZoneGroup" HeaderText="SOM_LoopBeingIsolated"
                                                                                SortExpression="BeingIsolatedZoneGroup"></asp:BoundField>
                                                                            <asp:TemplateField HeaderText="SOM_SaveOrUnsave" Visible="False">
                                                                                <ItemStyle Width="1px" />
                                                                                <ItemTemplate>
                                                                                    <asp:Image ID="imgSaveStatus" runat="server" ImageUrl="~/Images/SOM/UnsaveStatus.gif"
                                                                                        __designer:wfdid="w18"></asp:Image>
                                                                                </ItemTemplate>
                                                                            </asp:TemplateField>
                                                                            <%--add by benson 2015-08-26 :u171 begin --%>
                                                                            <asp:TemplateField HeaderText="COM_Status" SortExpression="EventStatusID">
                                                                                <ItemStyle Width="40px" />
                                                                                <HeaderStyle Width="1%" />
                                                                                <ItemTemplate>
                                                                                    <div style="display: none">
                                                                                        <asp:Label ID="lblStatusID" runat="server" Text='<%# Bind("EventStatusID") %>' __designer:wfdid="w49"></asp:Label>
                                                                                    </div>
                                                                                    <asp:Image ID="imgStatus" runat="server" __designer:wfdid="w50"></asp:Image>
                                                                                </ItemTemplate>
                                                                                <FooterStyle Width="40px" />
                                                                            </asp:TemplateField>
                                                                            <asp:TemplateField HeaderText="SOM_HighLight" SortExpression="HighLight">
                                                                                <ItemStyle Width="20px" />
                                                                                <HeaderStyle Width="20px" />
                                                                                <ItemTemplate>
                                                                                    <div style="display: none;">
                                                                                        <asp:Label ID="lblHighLight" runat="server" Text='<%# Bind("HighLight") %>' __designer:wfdid="w53"></asp:Label></div>
                                                                                    <asp:Image ID="imgHighLight" runat="server" __designer:wfdid="w55"></asp:Image>
                                                                                    <asp:HiddenField ID="hfEventStatusDesc" runat="server" Value='<%# Bind("EventStatusDesc") %>' />
                                                                                </ItemTemplate>
                                                                            </asp:TemplateField>
                                                                            <%--add by benson 2015-08-26 :u171 end --%>
                                                                            <asp:TemplateField HeaderText="COM_Edit">
                                                                                <EditItemTemplate>
                                                                                    <asp:TextBox ID="txtEdit" runat="server" __designer:wfdid="w17"></asp:TextBox>
                                                                                </EditItemTemplate>
                                                                                <ItemStyle Width="40px" />
                                                                                <%--updated by kernel 2012-11-19 for 1559 --%>
                                                                                <ItemTemplate>
                                                                                    <span style="vertical-align: top; cursor: hand;">
                                                                                        <asp:Image ID="imgEdit" runat="server" ImageUrl="~/Images/SOM/grid_edit.gif" __designer:wfdid="w16">
                                                                                        </asp:Image></span>
                                                                                </ItemTemplate>
                                                                            </asp:TemplateField>
                                                                            <asp:TemplateField HeaderText="COM_Delete">
                                                                                <EditItemTemplate>
                                                                                    <asp:TextBox ID="txtDelete" runat="server" __designer:wfdid="w3"></asp:TextBox>
                                                                                </EditItemTemplate>
                                                                                <ItemStyle Width="40px" />
                                                                                <ItemTemplate>
                                                                                    <span style="cursor: default">
                                                                                        <asp:ImageButton ID="imgDelete" runat="server" ImageUrl="~/Images/SOM/grid_delete.gif"
                                                                                            __designer:wfdid="w2" CommandName="Delete"></asp:ImageButton>
                                                                                    </span>
                                                                                </ItemTemplate>
                                                                            </asp:TemplateField>
                                                                        </Columns>
                                                                        <PagerTemplate>
                                                                            <asp:Table ID="CommonPagerTemplate" runat="server" Width="100%">
                                                                                <asp:TableRow ID="COMGRIDV_TR" runat="server">
                                                                                    <asp:TableCell ID="COMGRIDV_Pager_Cell_TotalRecords" runat="server" CssClass="GridView_Pager_Cell_TotalRecords">
                                                                                        <asp:Label ID="Lbl_T_TotalRecords" runat="server">Total Records:</asp:Label>
                                                                                        <asp:Label ID="Lbl_V_TotalRecords" runat="server"></asp:Label>
                                                                                        &nbsp; &nbsp;
                                                                                        <asp:Label ID="Lbl_V_CurPage" runat="server"></asp:Label>
                                                                                        &nbsp;<asp:Label runat="server">/</asp:Label>
                                                                                        &nbsp;<asp:Label ID="Lbl_V_TotalPages" runat="server"></asp:Label>
                                                                                    </asp:TableCell>
                                                                                    <asp:TableCell ID="COMGRIDV_Pager_Cell_PageSize" runat="server" CssClass="GridView_Pager_Cell_PageSize">
                                                                                        <asp:Label ID="Lbl_T_PageSize" runat="server">PageSize:</asp:Label>
                                                                                        &nbsp;&nbsp;<asp:DropDownList ID="DDL_PageSize" runat="server" AutoPostBack="True">
                                                                                            <asp:ListItem Value="5">5</asp:ListItem>
                                                                                            <asp:ListItem Value="10">10</asp:ListItem>
                                                                                            <asp:ListItem Value="15">15</asp:ListItem>
                                                                                            <asp:ListItem Value="20">20</asp:ListItem>
                                                                                            <asp:ListItem Value="25">25</asp:ListItem>
                                                                                            <asp:ListItem Value="30">30</asp:ListItem>
                                                                                        </asp:DropDownList>
                                                                                    </asp:TableCell>
                                                                                    <asp:TableCell ID="COMGRIDV_Pager_Cell_Prev" runat="server" CssClass="GridView_Pager_Cell_Prev">
                                                                                        <asp:LinkButton ID="LBtn_Previous" runat="server" CommandArgument="Prev" CommandName="Page"><</asp:LinkButton>
                                                                                    </asp:TableCell>
                                                                                    <asp:TableCell ID="COMGRIDV_Pager_Cell_PagerLink" runat="server" CssClass="GridView_Pager_Cell_PagerLink">
                                                                                        <asp:Panel ID="Pnl_PageLink" runat="server" CssClass="GridView_Pager_PageLinkPanel">
                                                                                        </asp:Panel>
                                                                                    </asp:TableCell>
                                                                                    <asp:TableCell ID="COMGRIDV_Pager_Cell_Next" runat="server" CssClass="GridView_Pager_Cell_Next">
                                                                                        <asp:LinkButton ID="LBtn_Next" runat="server" CommandArgument="Next" CommandName="Page">></asp:LinkButton>
                                                                                    </asp:TableCell>
                                                                                </asp:TableRow>
                                                                            </asp:Table>
                                                                        </PagerTemplate>
                                                                        <RowStyle CssClass="GridView_Row" />
                                                                        <EmptyDataTemplate>
                                                                            <asp:Table runat="server" CssClass="GridView_Header_EmptyData">
                                                                                <asp:TableRow runat="server">
                                                                                    <asp:TableCell runat="server" Style="border-right: black 1px solid;" Width="90px"></asp:TableCell>
                                                                                    <asp:TableCell runat="server" Style="border-right: black 1px solid;" Width="68px"></asp:TableCell>
                                                                                    <asp:TableCell runat="server" Style="border-right: black 1px solid;" Width="100px"></asp:TableCell>
                                                                                    <asp:TableCell runat="server" Style="border-right: black 1px solid;" Width="90px"></asp:TableCell>
                                                                                    <asp:TableCell runat="server" Style="border-right: black 1px solid;" Width="40px"></asp:TableCell>
                                                                                    <asp:TableCell runat="server" Style="border-right: black 1px solid;" Width="190px"></asp:TableCell>
                                                                                    <asp:TableCell runat="server" Style="border-right: black 1px solid;"></asp:TableCell>
                                                                                    <asp:TableCell runat="server" Width="20px"></asp:TableCell>
                                                                                </asp:TableRow>
                                                                            </asp:Table>
                                                                        </EmptyDataTemplate>
                                                                        <HeaderStyle CssClass="GridView_Header" />
                                                                        <AlternatingRowStyle CssClass="GridView_AlternativeRow" />
                                                                    </APJ:CommonGridView>
                                                                </td>
                                                            </tr>
                                                        </table>
                                                    </div>
                                                </fieldset>
                                            </ContentTemplate>
                                        </asp:UpdatePanel>
                                    </div>
                                    <div style="width: 99.6%;">
                                        <%--<fieldset style="clear: both; margin-bottom: 10px;">
                                            <legend class="title1"></legend>
                                            <div style="float: right; padding-top: 2px; padding-bottom: 5px;">
                                                <asp:Button ID="btnSaveBottom" runat="server" OnClick="btnSave_Click" TabIndex="39" />
                                            </div>
                                        </fieldset>--%>
                                        <asp:HiddenField ID="hdnfilePath" runat="server" Value="" />
                                        <asp:HiddenField ID="hdnfileName" runat="server" Value="" />
                                        <asp:HiddenField ID="hdncontent" runat="server" Value="" />
                                        <asp:HiddenField ID="hdndayBeforeParam" runat="server" Value="" />
                                    </div>
                                </ContentTemplate>
                            </asp:UpdatePanel>
                        </td>
                    </tr>
                    <tr>
                        <td>
                        </td>
                    </tr>
                    <tr>
                        <td class="Page_Foot" style="height: 53px">
                            <WebStructure:PageFoot ID="PageFoot" runat="server" />
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
    <div id="divFlowMenu" runat="server">
        <img alt="" src="../../Images/up.gif" onclick="SwitchMenu(this);" />
        <!--add flow menu items begin-->
        <div>
            <asp:Button ID="btnNew" runat="server" Text="New" OnClientClick="return CreatNew();"
                TabIndex="40" /><%--OnClientClick="return CreatNew();"--%>
        </div>
        <div>
            <asp:Button ID="btnCopyAsNew" runat="server" Text="Copy As New" OnClientClick="return CopyAsNew();"
                OnClick="btnCopyAsNew_Click" TabIndex="41" />
        </div>
        <div>
            <asp:Button ID="btnSave" runat="server" Text="Save" OnClick="btnSave_Click" TabIndex="42" />
        </div>
        <div>
            <asp:Button ID="btnHandoverCheck" runat="server" OnClientClick="OpenHandoverCheckPage(); return false;"
                Enabled="false" TabIndex="46" />
        </div>
        <div>
            <input id="btnGotoJobDescription" type="button" runat="server" onclick="GotoJobDescription()"
                tabindex="43" />
        </div>
        <div>
            <input id="btnGotoAssetLoan" type="button" runat="server" onclick="GotoAssetLoan()"
                tabindex="44" />
        </div>
        <div>
            <input id="btnGotoFireLink" type="button" runat="server" onclick="GotoFireLink()"
                tabindex="45" />
        </div>
        <%-- ///add by benson 2015-06-29 begin--%>
        <div>
            <asp:Button ID="btnBack" runat="server" Text="Back" Enabled="false" OnClientClick="javascript:backUrl();return false;" />
        </div>
        <%-- ///add by benson 2015-06-29 end--%>
        <!--add flow menu items end-->
    </div>
    <AjaxControlToolkit:AlwaysVisibleControlExtender ID="AlwaysVisibleControlExtender_FlowMenu"
        runat="server" TargetControlID="divFlowMenu" VerticalOffset="78" HorizontalOffset="1100">
    </AjaxControlToolkit:AlwaysVisibleControlExtender>
    <asp:HiddenField ID="hdnFlagDepature" runat="server" Value="0" />
    <asp:HiddenField ID="hdnFlagBookOff" runat="server" Value="" />
    <asp:HiddenField ID="hdnFlagNeedValit" runat="server" />
    <asp:HiddenField ID="hdnRequirePasswordStaffInfoID" runat="server" />
     <asp:Button ID="hidBtton" runat="server" Height="16px" Text="Button" ClientIDMode="Static"
                  Width="16px" onclick="hidBtton_Click"  style="display:none" />
    <input type="button" runat="server" id="btnCloseRecord" name="btnCloseRecord" onserverclick="btnCloseRecord_ServerClick"
        style="display: none;" />
    <%--onclick="OpenAmendEventTimeForm();"--%>
    <br />
    <div style="display: none">
        <asp:Button ID="btnDepatSave" runat="server" />
        <asp:Button ID="btnOpenDepartPage" runat="server" />
    </div>
    <div style="display: none;">
        <asp:HiddenField ID="HiddenField1" runat="server" />
    </div>
    </form>
</body>
</html>
<script type="text/javascript">
  function GotoJobDescription()
 {
    window.location.href = "#JobDescription";
 }
 
  function GotoAssetLoan()
 {
    window.location.href = "#AssetLoan";
 }
 
  function GotoFireLink()
 {
    window.location.href = "#FireLink";
}

  /* Add by Dylan 20150623 for ISSUE U48  */
  function OpenHandoverCheckPage() {
    var strURL = "../Popup/PopupHandOverCheck.aspx?StationEventID="+<%=StationEventID %>
    var returnValue = window.showModalDialog(strURL, window, "DialogWidth:400px;DialogHeight:320px;help:no;status:no;scroll:no;");
        if(returnValue!=undefined &&returnValue!="")   {
            var handOverCheck = returnValue.substring(returnValue.length - 1);
            var handOverNoteText = returnValue.substring(0,returnValue.length-1);
            if(handOverCheck=="0")   {
               document.getElementById("<%=this.chkHandoverCheck.ClientID %>").checked = false;
            } else {
               document.getElementById("<%=this.chkHandoverCheck.ClientID %>").checked = true;
            }
            document.getElementById("<%=this.txtHandoverCheckDetail.ClientID %>").value = handOverNoteText;
        }
    }
</script>
<script type="text/javascript">
    LoadHoverEvent(document.all.divFlowMenu);
    Sys.Application.add_load(SetFlowPos);
    window.onscroll = SetFlowPos;
    window.onresize = SetFlowPos;
    //var focus=document.activeElement.name;
    //document.getElementById("HiddenField1").value=focus;   
</script>
